Following my question here, I am now building nice treemaps.
I would like to show the aggregate value of the branch next to its label (Equities and ETFs). I have looked at px.treemap
and fig.update_layout
parameters but I can't find what I am looking for. Is it possible ?
fig = px.treemap(shares_data,
title=tit,
path=['Type', 'Stock'],
values='Holding',
color='Growth',
color_continuous_scale=[(0, "red"), (scale_mid, "yellow"), (1, "green")],
)
fig.update_layout(width=1600, height=950,
paper_bgcolor='black',
plot_bgcolor='black'
)
fig.update_traces(root_color="black")
fig.update_layout(title_font_color="white")
fig.update_layout(coloraxis_colorbar=dict(tickfont={"color":'white'},titlefont={"color":'white'}),)
fig.data[0].customdata = fig.data[0].marker.colors
fig.data[0].texttemplate = "<b>%{label}</b><br>Holding: R%{value:.2f}<br>Growth: <b>%{customdata:.1f}</b>%<br>"