I have some DataFrame to be plotted on plotly in bar chart.
Here is a dataframe example:
Here is an example of dataframe
I am trying to display on graph 2 direct data labels, but can not do it anyway. I want to show count and share separated by comma (e.g. "3.3M, 0.88"). Can anyone help me?
Below is my code:
import plotly.express as px
fig = px.bar(
df, x="range", y="count", hover_data=["share"], color="range", text="count", height=500, width=950,
color_discrete_sequence = px.colors.sequential.Plasma_r
)
fig.update_layout(xaxis_type="category")
fig.update_traces(texttemplate='%{text:.2s, }', textposition='outside')
pio.write_html(fig, 'cell_id.html')
fig.show()
Thank you beforehand!