我有一个Plotly Express图表:
fig = px.line(data, x="DateTime", y="Gold", title="黄金价格")
我想更改一些细节,就像这样:
fig.update_layout(
line_color="#0000ff", # ValueError: Invalid property specified for object of type plotly.graph_objs.Layout: 'line'
line=dict(
color='rgb(204, 204, 204)',
width=5
), # Bad property path: line
)
但是,我尝试了这里研究的两种解决方案,都失败了,错误信息在评论中给出。
我还尝试了fig = px.line(data, x="DateTime", y="Gold", title="Gold Prices", template="ggplot2", color_discrete_map={"Gold": "green"})
,但也没用。
请问如何使其工作?