In a new notebook, I can illustrate how the action of Magnify is cut off by the window width:

SetOptions[EvaluationNotebook[], WindowSize -> {600, 1000}]
p = Plot[x^2, {x, -1, 1}]
Magnify[p, 4]

enter image description here

At this point, the plot shows only the axis labels enlarged, whereas the documentation states that Magnify scales all aspects of the graphic. The expected behavior is recovered if we enlarge the window:

SetOptions[EvaluationNotebook[], WindowSize -> {1700, 1000}]

Notice how the previous plot is now scaled to twice the original size in all aspects.

Is there a way to use Magnify in windows of arbitrary size and always get a consistent result with all aspects of a graphic scaled by the same factor, as the documentation states?

  • $\begingroup$ Have you tried adjusting Formatting options/FontProperties/ScreenResolution (in the options inspector)? Default is 72, but that's too small on many newer screens. Craking it up to around 90 effectively zooms everything. $\endgroup$ – David Feb 10 '12 at 6:24
  • $\begingroup$ The reason I'm asking is that I want to use Magnify programmatically, as e.g. in this question [1]. It's not that I want to zoom all of the displayed content (I would do that using NotebookOptions>Display Options> Magnification). [1] mathematica.stackexchange.com/questions/1542/… $\endgroup$ – Jens Feb 10 '12 at 6:37
  • $\begingroup$ Please tell me if my suggestion to use ImageSize goes against what you are trying to do. $\endgroup$ – Mr.Wizard Feb 10 '12 at 7:01

Try setting ImageSize:

p = Plot[x^2, {x, -1, 1}, ImageSize -> 300];
Magnify[p, 4]

As Szabolcs kindly notes one may use ImageSize -> Medium to preserve the default sizing while still embedding an explicit ImageSize that prevents the resize-to-window behavior you wish to avoid.

You could also rasterize at 4X normal ppi (default 72) and display 1:1 :

ppi = CurrentValue["FontPropertiesScreenResolution"];

Image[p, ImageResolution -> 4 * ppi, Magnification -> 1]
| improve this answer | |
  • 1
    $\begingroup$ Actually I like the ImageSize suggestion because it gives you a baseline for all the other sizes in the plot, too. I would prefer something that can work with the fewest additional assumptions about the plot itself, but this looks pretty likely to be the optimal way. I'll get back to this tomorrow... $\endgroup$ – Jens Feb 10 '12 at 7:34

My own idea for a solution was

SetOptions[EvaluationNotebook[], WindowSize -> All]

This isn't exactly what I want, because it forces the notebook to adjust its window width to the magnified image. It's still a possible work-around, and it will depend on the application whether you prefer this method to setting an explicit image size for every graphic that is to be magnified.

| improve this answer | |
  • $\begingroup$ +1 It works, however for some reason Mathematica 8.0.4 does not scale ticks in your example. $\endgroup$ – Alexey Popkov Mar 2 '12 at 12:13
  • $\begingroup$ Yes, that's a problem. I know how to work around it in Graphics2D: Instead of saying Magnify[p,4], do this: Magnify[FullGraphics[p],4] but there's no such trick for Graphics3D. $\endgroup$ – Jens Mar 2 '12 at 16:18

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.