python - Adding multiple tables to plotly plot -
im trying best figure out way of plotting 2 tables on same plotly subplots cant seem past part. searching has has not been fruitful.
fig = tools.make_subplots(rows = 2, cols=1, subplot_titles=('continious features','catagorical features')) cont_table = ff.create_table(cont_data_matrix, index= true,index_title='feature') cat_table = ff.create_table(cont_data_matrix, index= true,index_title='feature') cont_table['figure'].extend() fig.append_trace(cont_table, 1,1) fig.append_trace(cont_table, 2,1) py.plot(fig)
i highly recommend using cufflinks library ties pandas , plotly, giving pandas dataframes iplot() command. https://plot.ly/ipython-notebooks/cufflinks/
import cufflinks cf import pandas pd table.iplot(kind='scatter', subplots=true, shape=(2,1), filename='cufflinks_test') so trick table set up. want data each trace in different columns, , index correspond x values. pivot_table() extremely useful getting data right shape.
if include dummy data cont_table , cat_table provide code combine them above code works.
Comments
Post a Comment