Found it really hard to export a high resolution .png while keeping the legends. Here is the code:

 Histogram[{data[[All, 2]], data[[All, 3]]}, 
  PlotLabel -> "Greenland & Antarctica mass frequency", 
  AxesLabel -> {"Mass(Gt)"}, 
  ChartLegends -> {"Greenland", "Antarctica"}], 
 ImageResolution -> 500]

And the exported image is like exported

How can I correctly format this and export?

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Chris K
    Oct 25, 2018 at 2:08

1 Answer 1


It seems the issue has to do with you using ImageResolution instead of ImageSize.

I didn't have your original data, so I fabricated some:

data = RandomInteger[{100, 1000}, 20]

Then ran similar code calling the fake data and using ImageSize->1000:

 Histogram[data, PlotLabel -> "Greenland & Antarctica mass frequency",
   AxesLabel -> {"Mass(Gt)"}, 
  ChartLegends -> {"Greenland", "Antarctica"}, ImageSize -> 1000]]

Here is what I came up with: enter image description here

If you want to change the text size you can do so with additional options.

  • $\begingroup$ Thanks for your reply. I have tried to use ImageSize, but the output image is kind of blurry, that's why I am using ImageResolution $\endgroup$
    – Shukai Ni
    Oct 25, 2018 at 5:50
  • $\begingroup$ In my previous answer, I had incorrectly placed the ImageSize in the export parameters. In my corrected example, I placed in the Histogram paramaters yielding a better result. You can make the image as big as you want, but you need to change the parameters for the text (key, axes, label, etc.) to compensate. $\endgroup$
    – kickert
    Oct 25, 2018 at 19:35
  • $\begingroup$ I suggest export as PDF format, if you don't insist using PNG. $\endgroup$ Oct 25, 2018 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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