# How to set desired view in 3D?

Consider very simple 3D object: Tube from {0,0,0} to {1,2,3}. I want to see projection to X-Z plane. My first attempt is:

Show[Graphics3D[Tube[{{0, 0, 0}, {1, 2, 3}}]],
Axes -> {True, False, True}, ViewPoint -> {0, ∞, 0}, Boxed -> False]


And I want Z axis being in horizontal direction, so I have to manually rotate by Pi/2 clockwise. Finally I get this: You see not ideal alignment of axes, but this is what I want to get.

Another attempt is as follows:

Show[Graphics3D[
GeometricTransformation[Tube[{{0, 0, 0}, {1, 2, 3}}],
Composition[ReflectionTransform[{1, 0, 0}],
RotationTransform[ -π/2, {0, 1, 0}]]]],
Axes -> {True, False, True}, Boxed -> False, ViewPoint -> Front]


With this I can get desired view, but picture is very different from first one: So, the question is: how to get X-Z projection and Z axis being horizontal?

• Have you seen ViewVertical? – J. M.'s discontentment Dec 16 '16 at 2:49
• @J.M., yes, I know about ViewVertical. I don't know how to use that in my case. If I replace in first code ViewPoint->{0, \[Infinity], 0} with ViewVertical->{0,1,0} I get the same result: projection to X-Z plane and Z axis is vertical. I need Z axis being horizontal. Please, explain how to use ViewVertical option? – Alx Dec 16 '16 at 3:36
• Try ViewVertical -> {1, 0, 0} ("make $x$ vertical"). – J. M.'s discontentment Dec 16 '16 at 4:16
• OK, adding ViewVertical->{1,0,0} to my first code solves the problem. Many thanks to @J.M.! My confusion was that if I set ViewPoint I'll have "plane" picture (projection to some plane) and I can't apply ViewVertical (I thought it has sense in 3D only). – Alx Dec 16 '16 at 4:24
• Another aside observation of MMA strange behaviour. If in fresh notebook I execute my original first code, this gives me some picture of plane projection. Let's denote this first In[] and Out] cells. Now in the oroginal first input cell I change ViewPoint->{0, \[Infinity], 0} with ViewVertical->{0,1,0} and execute this cell. The picture in output doesn't change. If I delete Out[] cell and run In[] again I'll have 3D view with Y axis being vertical, as it should be. Why MMA doesn't replace Out[] after In[] was edited? – Alx Dec 16 '16 at 4:49

No, as J.M. proposed in his comment this does exctly what I need:

Show[Graphics3D[Tube[{{0, 0, 0}, {1, 2, 3}}]], Axes -> {True, False, True},
ViewPoint -> {0, ∞, 0}, ViewVertical ->{1,0,0}, Boxed -> False]


does what I need and what is shown in my first picture. – Alx Dec 16 '16 at 10:43

Will this do:

     Show[Graphics3D[
Rotate[Tube[{{0, 0, 0}, {1, 2, 3}}], {{0, 0, 1}, {1, 0, 0}}]],
Axes -> {True, False, True}, AxesLabel -> {"z", "y", "x"},
ViewPoint -> {1.5, -100, 0.5}, Boxed -> False] ??

• No, as J.M. proposed in his comment this does exctly what I need: Show[Graphics3D[Tube[{{0, 0, 0}, {1, 2, 3}}]], Axes -> {True, False, True}, ViewPoint -> {0, \[Infinity], 0}, ViewVertical ->{1,0,0}, Boxed -> False] does what I need and what is shown in my first picture. – Alx Dec 16 '16 at 10:43