Traditional axes in 3d Mathematica plots?
Is there any way to tell Mathematica 7 to use "traditional" axes rather than boxing a three-dimensional graph? That is, rather than the default view produced by
Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},Boxed->False]
,
I would like three "axis arrows" to emanate from the origin.
Solution 1:
In the end, I ended up writing my own arrow routine, which produces scalable arrowheads and scalable labels:
axes[x_, y_, z_, f_, a_] := Graphics3D[ Join[{Arrowheads[a]}, Arrow[{{0, 0, 0}, #}] & /@ {{x, 0, 0}, {0, y, 0}, {0, 0, z}}, { Text[Style["x", FontSize -> Scaled[f]], {0.9*x, 0.1*y, 0.1*z}], Text[Style["y", FontSize -> Scaled[f]], {0.1 x, 0.9*y, 0.1*z}], Text[Style["z", FontSize -> Scaled[f]], {0.1*x, 0.1*y, 0.9*z}]}]]
The arguments are the x, y, and z positions of the x, y, and z arrows, respectively, f is the font scale (try about 0.05), and a is the arrowhead scale (about 0.05 should do it). This is combined with ordinary 3D graphics using Show[]
, as in
Show[Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}, Boxed -> False, PlotStyle -> Opacity[0.7], Mesh -> 4, Axes -> None], axes[2.5, 2.5, 1.5, 0.05, 0.02], PlotRange -> {{-3, 3}, {-3, 3}, {0, 1.5}}]
The resulting plot is
Solution 2:
You need the AxesOrigin Option.
Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},Boxed->False, AxesOrigin->{0,0,0}]
I misinterpreted your question in an earlier answer and I was suggesting using the "AxesEdge" Option which changes the sides of the bounding box on which the axes are displayed. However, you might still find that useful:
Plot3D[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2}, Boxed -> False, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}}]