【发布时间】:2022-01-04 09:56:50
【问题描述】:
我在这段代码中有 4 个指标:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(
rows=2,
cols=2,
subplot_titles=('Title 1', 'Title 2', 'Title 3','Title 4'),
specs=[[{'type': 'indicator'}, {'type': 'indicator'}],
[{'type': 'indicator'}, {'type': 'indicator'}]]
)
fig.add_trace(
go.Indicator(mode="number", value=2761),
row=1,
col=1,
)
fig.add_trace(
go.Indicator(mode="number", value=281),
row=1,
col=2,
)
fig.add_trace(
go.Indicator(mode="number", value=921),
row=2,
col=1,
)
fig.add_trace(
go.Indicator(mode="number", value=21),
row=2,
col=2,
)
fig.layout.annotations[0].update(yanchor='bottom', y=0.6)
fig.layout.annotations[1].update(yanchor='bottom', y=0.6)
fig.layout.annotations[2].update(yanchor='bottom', y=0)
fig.layout.annotations[3].update(yanchor='bottom', y=0)
fig.show()
这就是指标的显示方式:
我正在尝试更改值的颜色,例如我希望值 281 为蓝色。我不知道该怎么做,也没有在文档中找到任何东西。如果有人可以帮助我,谢谢:)
【问题讨论】:
标签: python plotly plotly-python