Is it possible to add custom text to bar chart text within the bar?

Hey @Gobrel ,

Try this:

import plotly.graph_objects as go

x = ['Product A', 'Product B', 'Product C']
y = [20, 14, 23]

# Use textposition='auto' for direct text
fig = go.Figure(data=[go.Bar(
            x=x, y=y,
            text=[str(i)+' Dollar' for i in y],
            textposition='auto',
        )])

fig.show()

Have a nice day.

1 Like