Change the color of labels inside a bar

Hello,

With the following code, I created a horizontal bar chart :
for i in subplots:
fig.add_trace(go.Bar(x = prix,
y = noms_produits,
marker_color = bar_palette[i],
text = liste_concatenee,
orientation=‘h’,
textposition=‘inside’,
insidetextanchor = ‘start’ if i < 2 else ‘end’,
width = 1,
constraintext= ‘none’),
row= i + 1,
col = 1)

How can I change the text color of the labels inside the bars ? The colors are currently automatic, I guess to contrast with the background color.

marker_color changes the background color of the bar, not the color of the text.

Thanks

You can specify the color of each bar in testfont.

textfont=dict(color=['blue','blue','blue','blue','yellow','yellow','yellow','yellow','black','black','black','black']
1 Like

It works, thanks!