如何将线条的 colored颜色 设置为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次,但我怀疑没有用,因为这是一条简单的线.

推荐答案

您可以在go.Scatter(...)通话中添加line=dict(color="#ffe476").这里的文档:https://plot.ly/python/reference/#scatter-line-color

Python-3.x相关问答推荐

海象表达可以放在方括号中而不是括号中吗?

CONNEXION.EXCEPTIONS.ResolverError:运行pyz文件时未命名模块

是什么原因导致Pandas=2.1.4和Pandas=1.4.2之间Pandas DataFrame中从Float64到int32的连续列转换方式不同

如何强调您正在寻求以 pandas 数据帧的另一列为条件的差异?

tkinter treeview 如何在获取所选项目时将设置的对象作为对象返回

对大型数据框中的选定列进行重新排序

Python根据条件从多行读取值

在 Python 中实现 COM 接口

asyncio.as_completed() 应该接受 `Iterable`,但如果输入是 `Generator` 就会崩溃?

!date 的命令无法从 jupyter notebook 运行

在字符串中查找正则表达式的所有模式

从 yahoo Finance python 一次下载多只股票

使用带有多线程的 win32com

带百分号的 Python 字符串格式

混合全局/参数和名为top的函数的奇怪python行为

使用 asyncio 的多个循环

TypeError: write() 参数必须是 str,而不是字节(Python 3 vs Python 2)

如何为 anaconda python3 安装 gi 模块?

TypeError:无法实例化类型元组;使用 tuple() 代替

python中的绝对导入是什么?