Hi,
I am trying to visualize multiple treemaps in a row. But the result is just blank - no error, no warning… nothing.
I am able to plot the data without looping it. Also, the loop is working just fine (tested it).
fig = go.Figure()
fig = make_subplots(
cols = 2, rows = 1,
column_widths = [0.4, 0.4],
subplot_titles = ('branchvalues: <b>remainder<br /> <br />', 'branchvalues: <b>total<br /> <br />'),
specs = [[{'type': 'treemap'}, {'type': 'treemap'}
# #, {'type': 'treemap'}, {'type': 'treemap'}
# # , {'type': 'treemap'}, {'type': 'treemap'}, {'type': 'treemap'}, {'type': 'treemap'}, {'type': 'treemap'}, {'type': 'treemap'}, {'type': 'treemap'}, {'type': 'treemap'}, {'type': 'treemap'}
]]
)
for m, i in zip(df_query["MONTH"].unique(),range(1,3)):
df = df_query.loc[((df_query["MONTH"]== m))].groupby(["MONTH","PRICE2"])\
.agg({"TTL" : "sum"})\
.groupby(level=0).apply(lambda x: round(100*x/x.sum(),0))\
.sort_values(by=["MONTH"], ascending=[True]).reset_index()
#######################
fig.add_trace(go.Treemap(
labels = df["MONTH"],
parents = df["MONTH"],
values = df["TTL"],
textinfo = "label+value+percent parent+percent entry+percent root",
root_color="lightgrey"
),row = 1, col = i)
fig.show()
Any ideas?