如何在 plotly
中设置线条的颜色?
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(rows=2, cols=1, subplot_titles=('Plot 1', 'Plot 2'))
# plot the first line of the first plot
fig.append_trace(go.Scatter(x=self.x_axis_pd, y=self.y_1, mode='lines+markers', name='line#1'), row=1, col=1) # this line should be #ffe476
我尝试了 fillcolor
但我怀疑它不起作用,因为这是一条简单的线。
原文由 Vader 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以在
go.Scatter(...)
调用中添加line=dict(color="#ffe476")
。此处的文档: https ://plot.ly/python/reference/#scatter-line-color