Hello Everyone,
I created a Treemap using plotly express from the dataframe below and its working as expected
The following is my code and output Treemap
fig = px.treemap( summary_df,path=[‘ANALYSISMETHOD’,‘NAME’], values=‘COUNT’)
fig.update_layout(
margin = dict(t=50, l=25, r=25, b=25))
fig.show()
I need to recreate this Treemap using plotly.graph_objects, mainly to use it in a subplot and have more control.
The problem is the go treemap never displays and I am not sure why.
Here is the Go Treemap code
import plotly.graph_objects as go
parents_list=[‘’]+summary_df[‘ANALYSISMETHOD’].values.tolist()
fig = go.Figure(go.Treemap(
labels = summary_df[“NAME”].values.tolist(),
parents = parents_list,
values= summary_df[“COUNT”].values.tolist(),
root_color=“lightgrey”,
textinfo =“label+value”
))
print (fig)
fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
fig.show()
Here is what the fig looks when i print it
Can anyone advise on what I am missing here ? I have been troubleshooting for hours.
Thank you