gpt4 book ai didi

python - Plotly:如何设置线条颜色?

转载 作者:行者123 更新时间:2023-12-04 11:09:26 32 4
gpt4 key购买 nike

如何在 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但我怀疑这不起作用,因为这是一条简单的线。

最佳答案

您可以添加 line=dict(color="#ffe476")在您的 go.Scatter(...) 内称呼。此处的文档:https://plot.ly/python/reference/#scatter-line-color

关于python - Plotly:如何设置线条颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58188816/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com