2
$\begingroup$

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. enter image description here Where as in the following cases, it is weird!

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

enter image description here 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.

$\endgroup$
  • $\begingroup$ I cannot reproduce this problem. What version of Mathematica are you using? Version 9 (based on the style of the plot)? $\endgroup$ – Szabolcs Nov 4 '16 at 11:43
  • $\begingroup$ 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? $\endgroup$ – Szabolcs Nov 4 '16 at 11:49
  • $\begingroup$ I am working in v 10.0.2.0 $\endgroup$ – Rajendra prasad Nov 5 '16 at 6:32
2
$\begingroup$

You have to define the ImageSize.

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

enter image description here

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.

$\endgroup$
  • $\begingroup$ 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! $\endgroup$ – Rajendra prasad Nov 5 '16 at 7:15
  • $\begingroup$ 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? $\endgroup$ – Sumit Nov 5 '16 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.