1
$\begingroup$

I'm creating plots that I want to export as png. Which works, but when I add sub- or superscript into the FrameLables or get 10^x in LogPlots the sub- or superscript letters in the exported png will be to large.

plot = LogPlot[x^3, {x, 0, 100}, Frame -> True,
FrameLabel -> {Superscript["x", "Super"], Subscript["y", "Sub"]}];
Magnify[plot, 3]

Export["plot.png", plot,  ImageResolution -> 300]
Export["plot.pdf", plot,  ImageResolution -> 300]

I get the following results: enter image description here

So everything is fine in the screenshot of the OS X Version and in the exported pdfs on OS X and Windows. But in the screenshot on Windows and the exported pngs (OS X and Windows) the sub- and superscript are to large.

When I just make a string with superscript and export it everything works as expected.

Magnify[Superscript["x", "Super"], 5]

Export["string.png", Magnify[Superscript["x", "Super"], 5], ImageResolution -> 300]

String Export

Can anybody verify this behaviour? And has a solution to fix this issue?

$\endgroup$
0
2
$\begingroup$

This was a puzzle but it seems the problem is caused by a ScriptMinSize option somewhere being set too high. I had a quick look but couldn't find the source of the problem. It is not the default TraditionalForm or GraphicsLabel styles in Core.nb.

So the problem is that on screen, and in an exported PNG, the superscript and subscripts appear to be the same font size as the body text. In that case doing this should reduce the superscript size:

Style[Superscript["x", "Super"], ScriptSizeMultipliers -> 0.7]

...but it didn't which led me to conclude that ScriptMinSize had been set too high. So I tried this and it worked:

Style[Superscript["x", "Super"], ScriptMinSize -> 5]

I'm assuming that in the process of converting to PDF the "more sensible" ScriptMinSize is applied which is why that works by default.

Someone might like to do some digging and find out which style in the style sheet is causing this problem ...that would make for an easy fix.

plot = LogPlot[x^3, {x, 0, 100}, Frame -> True, 
   FrameLabel -> {Style[Superscript["x", "Super"], ScriptMinSize -> 5], 
     Style[Subscript["y", "Sub"], ScriptMinSize -> 5]}];
Magnify[plot, 3]

Export["plot.png", plot, ImageResolution -> 300]
Export["plot.pdf", plot, ImageResolution -> 300]

Edit

In the course of doing something else this morning I noticed that the Working environment style in Core.nb has ScriptMinSize->9. This is most likely the cause of the problem. When PDFs are exported they use the Printout style which has ScriptMinSize->5 which explains why the PDF export was working ok.

$\endgroup$
1
  • $\begingroup$ I see. Thanks for the solution. I guess in that case it has something to do with the different zoom levels for Working and Printout style. Which is also the reason I have to Magnify[] the plots, so they have a reasonable size on screen compared to their printout counterparts. $\endgroup$ – theDriver Jan 30 '15 at 10:20

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.