
Re: Plot3D Axes Labels overlap plot axes and ticks?
Posted:
Mar 8, 2013 6:21 AM


Hi,
In Plot3D, my axes labels overlap my axes and ticks. Is there any way to fix this? Perhaps specify how far from the axes the labels should be?
Thanks,
Michael
Hi, Michael,
It is a bit difficult to answer without seeing your plot. I tried to generate an example. This:
Plot3D[Exp[x^2y^2],{x,2,2},{y,2,2},AxesLabel?{Style["X",20],Style["Y",20],Style["Name",20]},ImageSize?230]
is a 3D plot, where the name of the third axis "Name" overlaps with its ticks. Evaluate it. In general it is a problem of the image size used. If instead one uses the larger ImageSize option, the overlapping disappears. Check this:
Plot3D[Exp[x^2  y^2], {x, 2, 2}, {y, 2, 2}, AxesLabel > {Style["X", 20], Style["Y", 20], Style["Name", 20]}, ImageSize > 400]
Or this:
Plot3D[Exp[x^2  y^2], {x, 2, 2}, {y, 2, 2}, AxesLabel > {Style["X", 20], Style["Y", 20], Style["Name", 20]}, ImageSize > {300, 230}]
However, if you need to keep the image size as it is (for example in order to combine several images in a row on the page for printing), you may choose another way.
1. The most simple is to type one or more blank spaces before or after the name of the third axis. Check this:
Plot3D[Exp[x^2y^2],{x,2,2},{y,2,2},AxesLabel?{Style["X",20],Style["Y",20],Style[" Name",20]},ImageSize?230]
2. The more complex possibility but one with more control would be to introduce labels using Inset for the axes. Like this:
Plot3D[Exp[x^2  y^2], {x, 2, 2}, {y, 2, 2}, ImageSize > 230, Epilog > { Inset[Style["X", 20], Scaled[{0.2, 0.}]], Inset[Style["Y", 20], Scaled[{0.95, 0.3}]], Inset[Style["Name", 20], Scaled[{0.9, 0.7}]] }
]
Or like this:
Plot3D[Exp[x^2  y^2], {x, 2, 2}, {y, 2, 2}, ImageSize > 230, Epilog > { Inset[Style["X", 20], Scaled[{0.2, 0.}]], Inset[Style["Y", 20], Scaled[{0.95, 0.3}]], Inset[Rotate[Style["Name", 20], \[Pi]/2 + 0.1], Scaled[{0.07, 0.5}]] }
]
If the name of the third axes is large enough and you need it to be to the left (or to the right of the whole graph, I would write it sepatately and combine it by the Row statement.
There are some other ways also.
Have fun, Alexei
Alexei BOULBITCH, Dr., habil. IEE S.A. ZAE Weiergewan, 11, rue Edmond Reuter, L5326 Contern, LUXEMBOURG
Office phone : +35224542566 Office fax: +35224543566 mobile phone: +49 151 52 40 66 44
email: alexei.boulbitch@iee.lu

