Rotating the axes labels in 3D plots.

We will show how to rotate the axes-labels in a 3D plot so they are parallel to the axes.

plt1 = Plot3D[Sin[x + Cos[y]],{x,0, 2 Pi},{y,0,2 Pi}]

Step 1

To make this work we first need to get the coordinates of two points on a line parallel to you axes. You can do this using Input/GetGraphicsCoordinates. Note that the coordinates are given in 2D. Here are two points I selected on a line parallel to the y-axis in the above plot.

ptsx ={{0.0791065,0.187437},{0.410675,0.0626526}}

ptsy= {{0.82781,0.144653},{0.916942,0.294394}}

Step 2

Next we use the information in the FAQ to set up our rotated text.

*******************************************************
The following information is also available from the Technical
Support section of our webbiest at the following URL:

http://support.wolfram.com/mathematica/graphics/textfonts/parallel.html

   
   First, define the line and the point on the line where you
   want the text to be.
In[1]:= pt1 = {0, 0}; pt2 = {2, 1};

In[2]:= midpt = (pt1 + pt2)/2;

   To rotate the text, you need the slope of the line in vector
   form.
In[3]:= slope = pt2 - pt1;

   This slope is used as the fourth argument of a Text
   primitive to rotate the text parallel to the line.
In[4]:=
Show[Graphics[{Line[{pt1, pt2}], PointSize[.03], Point[midpt],
      Text["text", Offset[{-10, 10}, midpt], {0, 0}, slope],
      Text["more text", Offset[{10, -10}, midpt], {0, 0}, slope]},
    AspectRatio -> Automatic, Axes -> True]];
    
***************************************************************

slopex = ptsx[[2]]-ptsx[[1]]

midptx = (ptsx[[1]]+ptsx[[2]])/2

slopey = ptsy[[2]]-ptsy[[1]]

midpty = (ptsy[[1]]+ptsy[[2]])/2

Step 3

Now, instead of using this in a Show[Graphics[---]] command, as in the FAQ example, we add an Epilog to our Plot3D command.

plt1 = Plot3D[Sin[x + Cos[y]],{x,0, 2 Pi},{y,0,2 Pi},Epilog -> {Text["y-axis", Offset[{2,0}, midpty], {0, 0}, slopey], {Text["x-axis", Offset[{0, -5}, midptx], {0, 0}, slopex]}}]