# Exporting Legended plot with image resolution

I am trying to export an image in the following way:

p1 = Plot[Sin[x], {x, -3, 3}]
Export["sinx.jpeg", p1, ImageResolution -> 1200]


The exported image in this case extremely nice. Where as in the following cases, it is weird!

p1 = Plot[Sin[x], {x, -3, 3}, PlotLegends -> {"sinx"}]
Export["sinx.jpeg", p1, ImageResolution -> 1200]


How to obtain the same high resolution good quality image of the first case in the second one also along with legends?

Surprisingly in none of the exported images, tick marks are not visible where as in the copy&paste images they are visible!

Update: I am working on Version 10.0.2.0

Thank you.

• I cannot reproduce this problem. What version of Mathematica are you using? Version 9 (based on the style of the plot)? – Szabolcs Nov 4 '16 at 11:43
• I can reproduce it in v9. It's somehow related to the page width. Magnify[p1, 15] is also wrong. Can you upgrade to v10 or v11? – Szabolcs Nov 4 '16 at 11:49
• I am working in v 10.0.2.0 – Rajendra prasad Nov 5 '16 at 6:32

## 1 Answer

You have to define the ImageSize.

p1 = Plot[Sin[x], {x, -3, 3}, PlotLegends -> {"sinx"}, ImageSize -> 300]
Export["sinx.jpeg", p1, ImageResolution -> 1200]


I think by default MMA try to set the same imagesize to both the plot and the legend and combine them as a Graphics Grid.

• It has solved the problem. Can you suggest a way to export the image along with tick marks(lines) which are missing in the exported image? I have tried with option, ticks, ticks style and others. But none of them is successful! – Rajendra prasad Nov 5 '16 at 7:15
• The ticks are appearing very small because you set a huge ImageResolution. You can either reduce the resolution or manually increase the tick as described here Is there a way to make the tick marks larger? – Sumit Nov 5 '16 at 8:25