Home > Software design >  delete "sum of" from histogram px.df
delete "sum of" from histogram px.df

Time:11-10

import plotly.express as px
df = px.data.tips()
fig = px.histogram(df, x="day", y="total_bill", color='day', barmode='group')
fig.show()

well, i have a function like that

And it builds a histogram in plotly dash

but it makes with lable "sum of total_bill", but i need just "total_bill", how to fix?

CodePudding user response:

You can simply change the yaxis_title as follows:

import plotly.express as px
df = px.data.tips()
fig = px.histogram(df, x="day", y="total_bill", category_orders=dict(day=["Thur", "Fri", "Sat", "Sun"]))
fig.update_layout( yaxis_title="total_bill" )
fig.show()

enter image description here

  • Related