RE: Controlling axes labels in 3D plots

• To: mathgroup at smc.vnet.net
• Subject: [mg68932] RE: [mg68898] Controlling axes labels in 3D plots
• From: "David Park" <djmp at earthlink.net>
• Date: Wed, 23 Aug 2006 07:16:05 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Luiz,

Here is one way to do it from the sample case you sent. I first tried to do
this by using Epilog to add the labels as Text statements with direction
arguments. This does not work however because Mathematica will not display
the text much outside the bounding box. So I did a second method.

First make a plot without the axes labels.

data = Table[y*Sin[y/x], {y, -1, 1, 0.05}, {x, Pi/12, Pi/3, Pi/60}];

listplot =
ListPlot3D[data,
MeshRange -> {{Pi/12, Pi/3}, {-1, 1}},
PlotRange -> {{Pi/12, Pi/3}, {-1, 1}, {-1, 1}},
Mesh -> True,
ColorFunction -> Hue,
ViewPoint -> {-2.450, -0.770, 0.910}, Boxed -> False,
MeshStyle -> {GrayLevel[.2]},
TextStyle -> {FontFamily -> "Times", FontWeight -> "Plain",
FontSize -> 14}, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, 1}},
FaceGrids -> {{1, 0, 0}, {0, 1, 0}},
PlotRegion -> {{0, 1}, {0.1, 1}},
ImageSize -> 600];

If we put the 3D plot in a Rectangle on a larger sheet of paper, we then
have room to write the axes labels.
1) We must use the coordinates that go with with larger piece of paper. But
we can't just click them off the plot because the coordinates inside the
2) Similarly I got the slopes by trial and error.
3) When one puts text at an angle, the quality is not too good on the
screen, but it looks better when it is printed.
4) This is tailored to a single Viewpoint so you had better get that fixed
first.

Show[Graphics[
{Rectangle[{0, 0}, {2, 1}, listplot],
Text["This is the x axis", {1.9, 0.4}, {0, 0}, {0.32, 1}],
Text["This is the y axis", {0.95, 0.17}, {0, 0}, {1, -0.15}],
Text["This is the z axis", {0.07, 0.55}, {0, 0}, {-0.07, 1}]}
],
TextStyle -> {FontFamily -> "Times", FontWeight -> "Plain",
FontSize -> 14},
PlotRange -> {{-0.2, 2.2}, {-0.1, 1.05}},
ImageSize -> 600];

David Park

From: Luiz Melo [mailto:luiz.melo at polymtl.ca]
To: mathgroup at smc.vnet.net

Hi MathGroup,
It is possible to control the position and the direction of the axes labels
in a
3D plot? The label must stay parallel to its axis, whatever the value of the
Cheers,
Luiz

--
Luiz Melo
École Polytechnique de Montréal
Département de Génie Physique
C.P.6079, succ. Centre-ville