1

I want to show my value data within each box of my icicle chart, but the udpate_traces command I've used before for bar charts isn't working:

import plotly.express as px
# df is a pandas dataframe with columns level_1,2,3 and total
fig = px.icicle(df, path=['level_1', 'level_2', 'level_3'], values='total')
fig.update_traces(texttemplate="%{values:.1}")

This just prints out the text inside the "" in the icicle chart rather than the 'total' values to one decimal place. (Writing "%{total:.1}" does the same thing too.

Is there a way to display the values below the category label in a plotly icicle chart?

1 Answer 1

2

texttemplate requires value (without 's'):

fig.update_traces(texttemplate="%{value:.1}")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.