So, I’m using this code to create a table. Dash table does not work, as I am building a multipage app and in addtition to that the table is calculated as part of the output which also consists of multiple subplots… so cramming the table into a figure is really the only way to do this for me.
It actually works. BUT it’s upside down: The table of contents is shown as the last element and the one previous to last is the first element and so on… any idea how to fix this?
df_eval = pd.DataFrame(lst, columns=cols)
table_eval_all = ff.create_table(eval_all)
fig = tls.make_subplots(
rows=12,
cols=2,
#vertical_spacing=0.2,
specs=[[{'rowspan':2},{'rowspan':2}],
[None, None],
[{'rowspan':2},{'rowspan':2}],
[None, None],
[{'rowspan':2},{'rowspan':2}],
[None, None],
[{'rowspan':5, 'colspan':2},None],
[None,None],
[None,None],
[None,None],
[None,None],
[{}, {}]])
fig.append_trace(table_eval_all['data'][0],7, 1)
fig.layout.xaxis7 = {}
fig.layout.yaxis7 = {}
fig['layout'].update(height=3000, margin=dict(t=100, l=50, r=50, b=50))
fig.layout.yaxis7.update({'anchor': 'x7', 'domain': [0, .45]})
fig.layout.xaxis7.update({'anchor': 'y7'})
#Transfer the annotations from table['layout']['annotations'], and update each dict in the list of annotations, such that to reference them to xaxis4, yaxis4:
fig['layout']['annotations']=list(table_eval_all['layout']['annotations'])
for d in fig['layout']['annotations']:
d.update(xref='x7', yref='y7')
#removes vertical zeroline
fig['layout']['xaxis7']['zeroline']=False
#removes vertical zeroline
fig['layout']['xaxis7']['zeroline']=False