2

I have a plotly graph with more than 80 individual traces: Plotly png export of all traces

Now I want to export a png with only a few active traces like this: This is a screenshot of what I want it to look like

But when I export the image with the plotly camera icon it shows the top of the legend and not the legend of the active traces: Actual export with plotly

My question is, is there a way to tell plotly to export the graph with only the active trace legends visible?

Fiber22
  • 113
  • 1
  • 7

1 Answers1

1

This is pretty interesting. If you use the approch described here, and run

fig.write_image("yourfile.png")

...then you'll get the original fig object with all traces included. Even after subsetting the series through the legend.

But if you use the camera icon on the toolbar, then you'll get the edited version as a .png file.

enter image description here

vestland
  • 55,229
  • 37
  • 187
  • 305
  • 1
    Hello, may I ask a follow up question? Is it possible to export only the legend of the active traces? Like, in this example, only NFLX and MSFT? – TQA Sep 27 '21 at 08:11