0

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

Max Ghenis
  • 14,783
  • 16
  • 84
  • 132
  • Does this answer your question? [Python Plotly, how to remove background horizontal line?](https://stackoverflow.com/questions/42535785/python-plotly-how-to-remove-background-horizontal-line) – Eskandar Abedini Jun 04 '22 at 04:54
  • @EskandarAbedini no, I want to remove the dark blue and red lines atop the light blue and red areas. – Max Ghenis Jun 04 '22 at 05:54

1 Answers1

4

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

Drakax
  • 1,305
  • 3
  • 9