# “Save Graphic As…” does not include plot legends

I am creating some plots with Show but unfortunately the PlotLegends seems to be out of the bounding box when saving the graph.

Sample code:

data1 = {1, 2, 3};
data2 = {3, 4, 5};
Show[ListPlot[data1, PlotLegends -> {"Somedata1"}],
ListPlot[data2, PlotLegends -> {"Somedata2"}]]


Is there a way to include them so they can be exported along with the image?

-
@YvesKlett, ill fix that straight away. – JavaCake May 24 '13 at 7:28
@YvesKlett, went a tad too quick. It should be fixed now. – JavaCake May 24 '13 at 7:36
If you want to export it as a raster image, you can always use Rasterize. – nikie May 24 '13 at 9:10
Have you tried the legendMaker and the autoLegend functions in this post? It works perfectly for me and is the best solution for legends in MMA I've ever discovered on this site. – Leo Fang Jun 19 '13 at 1:08
Actually, you can use Export command to export your result as a picture such that Export["test.jpg",(*your result*)]. By this way the legend is included. – Z-Y.L Feb 17 '14 at 5:57

data1 = RandomReal[10, {10}];
data2 = RandomReal[10, {10}];
Show[ListPlot[data1, PlotLegends -> Placed[{"Somedata1"}, {1, .5}]],
ListPlot[data2, PlotLegends -> Placed[{"Somedata2"}, {1, .4}]]]


For different colors, just one ListPlot is enough sometimes.

ListPlot[{data1,data2},PlotLegends->Placed[{"Somedata1","Somedata2"},{1,.5}]]


-

I have found a way of making a pdf or eps file from a Plot with a Legend. Click on the plot till everything is selected, including the legends. Then save it a a pdf or eps file.... and that is it.

-

Instead of Show[], you should use all the data set in a single Plot[] (for your case it is ListPlot[]). It will automatically assign different Style or PlotMarker to distinguish different plots. And you can always put the legend at your desired position. As an example

data1 = Table[{x, Sin[x]}, {x, 0, 2 Pi, .1}]; label1 = "Sine";
data2 = Table[{x, Cos[x]}, {x, 0, 2 Pi, .1}]; label2 = "Cosine";

Needs["PlotLegends"]
position = {0.25, 0.25};
size = {0.3, 0.2};
ListPlot[{data1, data2}, PlotStyle -> {Black, Red}, PlotLegend -> {label1, label2}, LegendShadow -> None, LegendBorder -> Automatic, LegendSize -> size, LegendPosition -> position]
`

You can easily vary the position of your Legend and in will be in the same place in exported file as well.

-