I am plotting two sets of data, when I put legend in each separate graph, then use show, it give me the combined graph with the legend on the right of the graph. After that, when I export the graph in any format it does not show the legend.
Could any one help me on how to show the legend in the upper right corner of the graph generated from the show command, and to make it appear in the exported graphic.
Best regards
1 Answer
pos = Placed[#, Scaled@{0.9, 0.75}] &;
a = ListPlot[Table[Sin[x], {x, 0, 2 \[Pi], \[Pi]/18}], Frame -> True,
PlotMarkers -> {Style["+", Blue], 14}, PlotLegends -> pos@{"a"}];
b = ListPlot[Table[Sin[x], {x, 0, 2 \[Pi], \[Pi]/18}], Frame -> True,
PlotMarkers -> {Style["O", Red], 10}, PlotLegends -> pos@{"a"}];
Show[a, b]
The {0.9,0.75}
in Placed
are coordinates of the legend in relative units
Frame
. $\endgroup$