Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I understand that Mathematica has a bug when exporting images. The ticks are scaled not correctly when exporting at high resolution. For example: when you do:

Export["xx.png", plot, ImageResolution -> 360];

The image looks good, but all the frame ticks are all gone. When you do

Export["xx.png", plot, ImageResolution -> 100];

The ticks are there, but the resolution of the image is not good enough.

I tried the trick of using ImportString and ExportString:

ImportString[ExportString[plot, "PDF"]

It works, but creates another problem: the PlotRangeClipping option is missing, and the figure has plot lines sticking out all the way to the boundary of the image, not the boundary of the axes.

Can someone provide an easy and relatively universal workaround?

share|improve this question
1  
See here: stackoverflow.com/questions/8805451/… –  Szabolcs Jun 23 at 22:33
    
Do you need it to be a rasterized image? If not, you can probably export it as a vector graphic (.pdf or .eps) which can scale to whatever size you need later, and then you don't need to define a resolution on export. –  ThomasH Jun 24 at 8:31
    
Hi. Exporting it as a vector graphic .pdf or .eps does work. However, neither of these are friendly with Microsoft, so I can't easily put them in the context. –  Jun Yang Jun 24 at 15:24
    
My current solution is using export to PDF and then use ImageMagick to convert the pdf file to png. It's a bit walkaround, but the result is consistent. I wrote a small script so that it all works automatically: Unprotect[exportFigure]; exportFigure[figure_,fileName_]:=Module[{}, Export["D:\\Documents\\temp\\tmp.pdf",figure]; Run["convert_Image.exe -density 600 \"D:\\Documents\\temp\\tmp.pdf\" \""<>fileName<>"\""] ]; Protect[exportFigure]; –  Jun Yang Jun 24 at 20:22
add comment

1 Answer 1

This problem is described here as well.

Slava Nadvorny suggests using manual Ticks specifications. In this case they will scale with ImageResolution.

The CustomTicks package will make it considerably easier to create manual tick specifications.

share|improve this answer
2  
BTW I believe this is a bug. Why don't you ask support at wolfram.com about it? If more people complain there's higher chance that it'll be fixed. –  Szabolcs Jun 23 at 22:35
1  
I envy your optimism... –  Jens Jun 24 at 3:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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