Plotly:如何设置线条颜色? [英] Plotly: How to set line color?
本文介绍了Plotly:如何设置线条颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在plotly
中设置线条的颜色?
How can I set the color of a line in 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
但我怀疑它不起作用,因为这是一条简单的线.
I tried fillcolor
but that I suspected doesn't work because this is a simple line.
推荐答案
您可以在 go.Scatter(...)
调用.此处的文档:https://plot.ly/python/reference/#scatter-line-颜色
You can add line=dict(color="#ffe476")
inside your go.Scatter(...)
call. Documentation here: https://plot.ly/python/reference/#scatter-line-color
这篇关于Plotly:如何设置线条颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文