从Plotly Express区域图中删除系列边界线

发布于 2025-02-04 06:21:57 字数 640 浏览 5 评论 0原文

px.area在每个区域系列上显示一条线。如何删除它?

文档仅显示如何显示如何显示要从GO.Scatter呼叫中删除行(带有mode ='none'')。

这是一个示例(

import plotly.express as px

px.area(y=[[1, 2, 3], [0, 0, 1]])

px.area shows a line atop each area series. How can I remove it?

The documentation only shows how to remove lines from go.Scatter calls (with mode='none').

Here's an example (notebook), where I'd like to remove the dark blue and red lines atop the light blue and red areas, respectively (to avoid the perception that the red series is nonzero where it stacks atop the blue series):

import plotly.express as px

px.area(y=[[1, 2, 3], [0, 0, 1]])

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沧笙踏歌 2025-02-11 06:21:58

iiuc这是您要寻找的:

import plotly.express as px

fig = px.area(y=[[1, 2, 3], [0, 0, 1]])

”“在此处输入图像说明”

如果您想要linestraces相同的颜色:

for i in range(len(fig['data'])):
  fig['data'][i]['line']['width']=0

/I.SSTATIC.NET/1TT3S.png“ rel =“ noreferrer 您想要traceslines相同的颜色:

fig.for_each_trace(lambda trace: trace.update(fillcolor = trace.line.color))

“在此处输入图像说明”

IIUC this is what you're looking for:

import plotly.express as px

fig = px.area(y=[[1, 2, 3], [0, 0, 1]])

Before:

enter image description here

If you want lines same color as traces:

for i in range(len(fig['data'])):
  fig['data'][i]['line']['width']=0

enter image description here

If you want traces same color as lines:

fig.for_each_trace(lambda trace: trace.update(fillcolor = trace.line.color))

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文