# Reversing one axis in Plot3D

When I rotate my 3D plot to the desired viewpoint my X axis runs from 1 at the left to 0 at the right. How can I mirror my plot so that 0 will be at the left and 1 at the right?

Extra credit: how can I get the ViewPoint vector after manual rotation?

-
You can get the answer to your extra credit question here. –  VLC Aug 11 '12 at 12:28

To answer the last part of question, this can be done by setting something like ViewPoint -> Dynamic[vp] in the plot definition. Then the value of vp will be dynamically updated to the current view point when you rotate the plot. Try for example

Plot3D[x^4 y, {x, 0, 1}, {y, 0, Pi}, PlotRange -> All, ViewPoint -> Dynamic[vp]]
Dynamic[vp]


Note that vp must be defined as a triple of numbers.

As for the first part of your question, I don't know how you're creating your plot, but if you're using Plot3D you could just swap the second and third argument. For example

vp = {1, 1, 1};
Plot3D[x^4 y Sin[5 y], {x, 0, 1}, {y, 0, Pi}, PlotRange -> All,
ViewPoint -> Dynamic[vp]]
Plot3D[x^4 y Sin[5 y], {y, 0, Pi}, {x, 0, 1}, PlotRange -> All,
ViewPoint -> Dynamic[vp[[{2, 1, 3}]]]]


Note that this will effectively swap the x- and y-axis, thus changing the coordinate system from being right-handed to left-handed.

-

There is a simpler way to see the ViewPoint vector (and many other plot attributes) after a manual rotation: just type //Options right after the Graphics object and evaluate.

-

As an alternative to swapping x and y axes in Heike's answer, you can use a combination of settings for AxesEdge and ViewPoint:

 vp = {-2, 3, 2};
Plot3D[Sin[x + y^2], {x, 0, 1}, {y, -1, 1},
BoxRatios -> 1, AxesLabel -> {"X", "Y", "Z"}, Axes -> True,
AxesEdge -> {{1, 0}, {0, 0}, {0, 0}}, ViewPoint -> Dynamic[vp],
PlotLabel -> Dynamic[vp]]


-
Am I right that this only places the axes on the other side of the bounding box? It doesn't allow the Y = -1 to coincide with the X = 0, it seems. –  stevenvh Aug 11 '12 at 13:55
@stevenvh, does changing AxesEdge->{{-1, 0}, {0, 0}, {0, 0}} give what you need? –  kguler Aug 11 '12 at 14:03
No. I want the curve to be mirrored through the Y = 0 plane, so that Y = -1 and Y = 1 exchange places. –  stevenvh Aug 11 '12 at 14:06
I see...perhaps some of form of ReflectionTransform.. –  kguler Aug 11 '12 at 14:37
Sorry, still not what I want, I guess. I checked ReflectionTransform, and as I understand it it reflects the function, so that will be mirrored, but the axis won't. I need a mirrored view of the curve, but because the axis is reflected, not the function. Sorry. Thanks for your time, though. –  stevenvh Aug 11 '12 at 14:50