A couple of years ago, I made a plot using this code:

h = 1;
H = (1/2)*(p^2 + x^2);
rho[n_] = (1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h];

ImageCrop[Plot3D[rho[0], {x, -5, 5}, {p, -5, 5}, PlotPoints -> 200,  PlotRange -> All, ImageSize -> 800,  AxesLabel -> {Style[x, FontSize -> 40], Style[p, FontSize -> 40]}, AxesStyle -> 15, Boxed -> False, TicksStyle -> Directive[FontSize -> 20]]]

that looked like enter image description here

I copied and pasted the code with absolutely no changes into Mathematica, and I got this image: enter image description here

How do I make the bottom image look like the top image? The one item that I really care about is the axis label. If I label only a single axis, I can use the same code (without the Style[p, FontSize -> 40]), and the axis label is large enough. However, the moment that I add in a label for both the $x$ and $p$ axis, I can no longer make the axis labels larger. Is there an extra graphics option that I need to include?

  • $\begingroup$ Thank you. I am not too sure what I was thinking when I gave AxesStyle a number. I probably had more associated with AxisStyle, but decided not to use it, and forgot to remove the entire directive $\endgroup$
    – user85503
    Dec 23, 2016 at 22:30
  • $\begingroup$ @JasonB AxesStyle -> 15 is a valid specification for a font size of 15. Try AxesStyle -> 50 and see for yourself. $\endgroup$
    – Mr.Wizard
    Dec 24, 2016 at 5:36

1 Answer 1


There is no reason not to use the option AxesStyle -> 40. AxesStyle affects the axes labels and in a style specification an integer is taken as a point size specification. But if you give the point size specification in AxesStyle, you don't need to repeat it in AxesLabel.

So you can use simple form.

Block[{x, p},
  rho[n_][x_, p_] =
    With[{h = 1, H = (1/2)*(p^2 + x^2)}, 
      (1/Pi) (-1)^n Exp[-2 H/h] LaguerreL[n, 4 H/h]]];

  Plot3D[rho[0][x, p], {x, -5, 5}, {p, -5, 5},
    PlotPoints -> 100, 
    PlotRange -> All,
    ImageSize -> 800,
    AxesLabel -> {x, p, None},
    AxesStyle -> 40,
    Boxed -> False,
    TicksStyle -> 20,
    PlotTheme -> "Classic"]]


This image was made in V11.0.1.

P.S. The reason you had ran into a problem with your options was that you specified

AxesLabel -> {Style[x, FontSize -> 40], Style[p, FontSize -> 40]}


AxesLabel -> {Style[x, FontSize -> 40], Style[p, FontSize -> 40], None}

is required. In a 3D plot you should specify labels for all three axes. If you could get away with specifying labels for only two of the axes in older versions of Mathematica, that was a bug that has been fixed. The form with all three elements specified works as you would expect.


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.