【发布时间】:2021-12-14 14:53:41
【问题描述】:
我绘制了一个堆积条形图,并希望将 Apr_max 设置为与其他 (RED) 不同的第一列颜色(例如绿色)。
目前我的代码是:
fig_page2 = px.bar(data_frame=df_raw,
x='Company', y=['Apr_Min', 'Apr_Max'],
barmode="stack", labels={'variable': ' ', 'value':'Number'},
color_discrete_sequence=['rgb(233,233,233)', 'rgb(255,69,0)'],
width=1000, height=400).update_layout(autosize=True,
title={
'text': "APR Comparison", 'y':0.9,'x':0.5,
'xanchor': 'center',
'yanchor': 'middle'},
yaxis=dict(title='APR Range', tickformat=',.0%', range=[0,1]),
paper_bgcolor='rgb(233,233,233)',
plot_bgcolor='rgb(233,233,233)',
showlegend=False)
结果如下: enter image description here
如何将突出显示的条设置为绿色,同时保留其余颜色?
ps:我的数据集: enter image description here
【问题讨论】:
标签: colors bar-chart plotly-python