i need your help to reduce decimal places to 2 in my bar chart created by Ployly Express.
enter image description here
my code is:
fig8 = px.bar( new_data, x=["Loyal", "Exited"], y=["active", "inactive"], title="Distribution of active membership in loyal and exited clients group", width=700, orientation="v", color_discrete_map={"active": "green", "inactive": "yellow"}, barmode="stack" ) fig8.update_layout(xaxis_title_text="Types of clients", yaxis_title_text="Number of clients, %", barnorm="percent") fig8.update_traces(marker_line_width = 0, texttemplate = "%{y}%") fig8.layout["legend"]["title"] = "Type of clients membership" fig8.show()
For my bar chart i ve used this table where data is not in percents. I ve chosen the barnorm="percent" and i can t change it to 2 decimal places.enter image description here
I have used a lot of advices as text_auto="%.2f" and texttemplate = "%{y:%.2f}%". It didn t help.