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?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.