0

As the output of the following code shows, by default Mathematica does not necessarily place the axes label for 3D graphics at the positive ends of the axes, for axes emanating from the origin.

In the graphical output, the y-axis label is at the negative end, contrary to the way a mathematician would ordinarily label such a figure.

Is there some option to have the labels put at the positive ends?

 ParametricPlot3D[{2 Cos[θ], 2 Sin[θ], 0}, {θ, 0, π/2}, 
    PlotStyle -> Thick, PlotRange -> {{-3, 3}, {-3, 3}, {-2, 2}},
    Boxed -> False, AxesOrigin -> {0, 0, 0}, 
    AxesLabel -> (Style[#, 16] &) /@ {"x", "y", "z"}]

y-axis label is at negative end of axis

kglr
  • 394,356
  • 18
  • 477
  • 896
murray
  • 11,888
  • 2
  • 26
  • 50

2 Answers2

1
ParametricPlot3D[{2 Cos[\[Theta]], 2 Sin[\[Theta]], 0}, {\[Theta], 
  0, \[Pi]/2}, PlotStyle -> Thick, 
 PlotRange -> {{-3, 3}, {-3, 3}, {-1, 2}}, Boxed -> False, 
 AxesOrigin -> {0, 0, 0}, 
 AxesLabel -> (Style[#, 16] &) /@ {"x", "y", "z"}, ViewAngle -> Pi/8]

fig1

Second model

ParametricPlot3D[{2 Cos[\[Theta]], 2 Sin[\[Theta]], 0}, {\[Theta], 
  0, \[Pi]/2}, PlotStyle -> Thick, 
 PlotRange -> {{-3, 3}, {-3, 3}, {-1, 2}}, Boxed -> False, 
 AxesOrigin -> {0, 0, 0}, 
 AxesLabel -> {Style[x, 16], Style[y, 16], Style[z, 16]}]

fig2

Alex Trounev
  • 44,369
  • 3
  • 48
  • 106
  • Yes, I know about ViewAngle; and in fact one can just manually drag the 3D graphic to reorient the axes like that and so have axes "properly" labeled at their positive ends. But I was hoping for another option that forced the labels to the positive ends, no matter what the orientation. – murray Nov 30 '18 at 22:59
  • And the method of using ViewAngle, unfortunately, does not work if I give the parameter a variable terminal value and put the resulting ParametricPlot expression inside a Manipulate where that terminal value is the control variable. – murray Nov 30 '18 at 23:06
  • Correction to my comments: your input does not produce with Mathematica 11.3 the output you show! The axes retain their position as if the ViewAngle option were not there. – murray Nov 30 '18 at 23:10
  • @murray I just answered your question. If you want to ask another question ask it. – Alex Trounev Nov 30 '18 at 23:11
  • My $Version Out[]= "11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)" – Alex Trounev Nov 30 '18 at 23:14
  • My $Version: "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)". – murray Dec 01 '18 at 01:27
  • it's funny that the result depends on the operating system. ok i'll look for another method – Alex Trounev Dec 01 '18 at 01:38
  • @murray I added a second code using Style[] – Alex Trounev Dec 01 '18 at 01:50
  • No, the second model produces the same (undesirable) result as the first with macOS. – murray Dec 01 '18 at 15:47
  • @murray it looks like a bug. – Alex Trounev Dec 01 '18 at 15:56
  • According to the documentation, ViewAngle should not change the location or orientation of the axes! All it does is change a camera's opening angle from which the graphic is viewed, thereby in effect moving the viewed object closer or further away. The appropriate option seems to be ViewPoint. – murray Dec 02 '18 at 15:25
0

While I still don't understand why, by default under the macOS front end, the original code oriented the axes with the positive x-axis pointing backwards, the following with use of ViewPoint gives the result I was looking for.

 ParametricPlot3D[{2 Cos[\[Theta]], 2 Sin[\[Theta]], 0}, {\[Theta], 0, \[Pi]/2}, PlotStyle -> Thick, 
   PlotRange -> {{-3, 3}, {-3, 3}, {-1, 2}}, Boxed -> False, 
   AxesOrigin -> {0, 0, 0}, AxesLabel -> (Style[#, 16] &) /@ {"x", "y", "z"}, 
   ViewPoint -> {Pi, Pi/2, 2}]

Orientation with positive x-axis pointing forward

murray
  • 11,888
  • 2
  • 26
  • 50