Normally the Z axis is plotted from bottom-to-top as shown below : normal z-axis running bottom-to-top

I got a plot with the axis (axes to be more precise) reversed as shown below:enter image description here

Is there a way to force the axes to be plotted top-to-bottom?



Mathematica graphics is interactive. Just drag & rotate the plot with mouse till you flip it up side down. You also can do this programmatically:

Plot3D[Sin[x y]^2, {x, -2, 2}, {y, -2, 2}, ViewPoint -> {-1, -2.5, -1}, 
ViewVertical -> {0, 0, -1}]

enter image description here

Here is how I got these options - if you are curious. Produce Mathematica 3D graphics object and play with it by rotating it around. As soon as you like its orientation excute


And get something like this:

Out[2] = {Axes -> True, BoxRatios -> {1, 1, 0.4},  Method -> 
{"RotationControl" -> "Globe"}, PlotRange -> {{-2, 2}, {-2, 2}, {0., 1.}}, 
PlotRangePadding -> {Scaled[0.02], Scaled[0.02], Scaled[0.02]},  
ViewPoint -> {-1, -2.5, -1}, ViewVertical -> {0, 0, -1}}

Options ViewPoint and ViewVertical will be most important for your particular case. You can use them now in your code to avoid the need to adjust graphics interactively every time.

NOTE (thanks to @Heike comment below):

In some cases if Options[%] does not work you may try this:

enter image description here

which will produce the set of options I showed above.

  • $\begingroup$ Well, that's a boring solution. :-) $\endgroup$ – Brett Champion Mar 14 '12 at 20:44
  • $\begingroup$ @BrettChampion I'd be happy to see someone cooking something more entertaining ;-) $\endgroup$ – Vitaliy Kaurov Mar 14 '12 at 20:47
  • $\begingroup$ The values for ViewPoint and ViewVertical aren't updated on my system when I evaluate Options[%] after rotating the plot. The only way I can get the updated values is to wrap Options[] directly around the actual plot, rotate the plot, and re-evaluate the whole expression. $\endgroup$ – Heike Mar 14 '12 at 21:02
  • $\begingroup$ @Heike I'm running M. V8.0.4 on Win7 - works for me. What is your system? $\endgroup$ – Vitaliy Kaurov Mar 14 '12 at 21:10
  • $\begingroup$ @VitaliyKaurov I'm using v8.0.4 on OS X. $\endgroup$ – Heike Mar 14 '12 at 21:11

Using ScalingFunctions

Plot3D[Sin[x y]^2, {x, -2, 2}, {y, -2, 2},
 ScalingFunctions -> {Identity, Identity, "Reverse"}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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