Aligned Axes Labels on Plot3D
- To: mathgroup at smc.vnet.net
- Subject: [mg34014] Aligned Axes Labels on Plot3D
- From: Goyder Dr HGD <H.Goyder at rmcs.cranfield.ac.uk>
- Date: Fri, 26 Apr 2002 03:27:44 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
The axes labels obtained by using AxesLabel in Plot3D are unsatisfactory because they are always horizontal. In my view the z label looks particularly odd if it is long. For example (with some size exaggeration) \!\(\(Plot3D[Sin[x\ y], {x, 0, 4}, {y, 0, 5}, \[IndentingNewLine]\ ColorFunction\ -> \ Hue, TextStyle -> {FontFamily -> "\<Times\>", FontSize -> 12}, \[IndentingNewLine]AxesLabel -> \ {StyleForm["\<X-axis / \ (m/s)\>", FontSize -> 18, FontFamily -> "\<Times\>"], \ \[IndentingNewLine]StyleForm[\*"\"\<Y-axis / (m/\!\(s\^2\))\>\"", FontSize -> 18, FontFamily -> "\<Times\>"], \ \[IndentingNewLine]StyleForm["\<Z-axis / (kg/Hz)\>", FontSize -> 18, FontFamily -> "\<Times\>"]}];\)\) I have used Epilog and Text to produce axes labels that are at an angle and oriented to lie parallel to the coordinate axes. Thus \!\(\(Plot3D[Sin[x\ y], {x, 0, 4}, {y, 0, 5}, \[IndentingNewLine]\ ColorFunction\ -> \ Hue, TextStyle -> {FontFamily -> "\<Times\>", FontSize -> 12}, \[IndentingNewLine]PlotRegion -> {{0.1, 1}, {0, 1}}, \[IndentingNewLine]Epilog -> \ {\[IndentingNewLine]Text[ StyleForm["\<X-axis / (m/s)\>", FontSize -> 18, FontFamily -> "\<Times\>"], {0.35, 0.15}, {1, 0}, {1, \(-0.36\)}], \[IndentingNewLine]Text[ StyleForm[\*"\"\<Y-axis / (m/\!\(s\^2\))\>\"", FontSize -> 18, FontFamily -> "\<Times\>"], {0.9, 0.25}, {1, 0}, {1, 1.6}], \[IndentingNewLine]Text[ StyleForm["\<Z-axis / (kg/Hz)\>", FontSize -> 18, FontFamily -> "\<Times\>"], {\(-0.03\), 0.4}, {1, 0}, {\(-1\), 7}]\[IndentingNewLine]}];\)\) This works well and prints better than it displays on screen. However, I have had to position and rotate the labels by hand guessing the direction. I have also had to shrink the plot using PlotRegion to allow room for the axis label. Has anyone done this automatically? For the direction of the text I need the 2D vector that is the projection of each axis. For the coordinates of the text I need the 2D vector for the middle of each axis. Thanks in advance Hugh Goyder