Message Boards Message Boards

How to export a plot (or graph) together with its legend?

Posted 9 years ago
POSTED BY: Rene Samson
5 Replies
Posted 9 years ago

Tnx David....So nice!

POSTED BY: Hadi Tokme
Posted 9 years ago

I also find that with Version 10.3 on Windows you can select the cell containing the graphic, right-click, and choose "Save Selection As" to save a graphic which will include the legend:

enter image description here

The saved png is:

enter image description here

POSTED BY: David Keith
Posted 9 years ago

David's suggestion was the easiest and fastest solution for me. Thanks a heap. René Samson

POSTED BY: Rene Samson
Posted 9 years ago

I find that when using legends created by PlotLegends, selecting the graphic and then using "Save graphic as" does not include the legend, apparently because the legend graphic is not selectable. However, assigning the graphic to a variable and using export does include the legend. For example:

p1 = Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi}, 
   PlotLegends -> "Expressions"];

Export["exportP1.png", p1]

will save p1 as a png and it will include the legend.

I'm on 10.0.2 and Win 7 x64.

POSTED BY: David Keith
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract