How to change the labels in color instead of color #… strings.
I tried to define c
as a dictionary instead if an array but it didn’t work.
def update_figure_profits(df0,
label,
xlabel=None,
ylabel=None,
title=None,
percent_fmt=False):
c = ['#636EFA', '#EF553B', '#00CC96',
'#AB63FA', '#FFA15A', '#19D3F3'] * 3
df = df0[[label, 'name']].copy()
fig = px.bar(df,
x=range(len(df)),
y=label,
color=c,
)
fig.update_layout(xaxis=dict(
tickmode='array',
tickvals=list(range(18)),
ticktext=['', '', 'کامل', '', '', ''] + ['', '', 'متغیر', '', '', ''] +
['', '', 'فرامتغیر', '', '', '']
)
)
fig.update_layout(xaxis_title=xlabel,
yaxis_title=ylabel,)
fig.update_layout(title_text=title, title_x=0.5)
return fig