Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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], alt text

I would like three "axis arrows" to emanate from the origin.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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

alt text

share|improve this answer
add comment

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}}]

share|improve this answer
    
That's 50% of what I'm looking for - do you know if it's possible to cut off the negative bits, so that the axes are rays instead of lines? –  Josh Guffin Jan 5 '11 at 23:02
    
@Josh Guffin: Do you need numbers on the axes? –  Henry B. Jan 5 '11 at 23:22
    
In general no, but I would like them to be drawn by the system rather than adding them in by hand (with Graphics[] directives); I don't want to have to specify the length of the arrows every time. –  Josh Guffin Jan 5 '11 at 23:25
    
@Josh Guffin: Yes. You read my mind. I think you can use the Scaled command to fix the size of relative size of the arrows. –  Henry B. Jan 5 '11 at 23:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.