1
$\begingroup$

I have the following code to show the rotation of a prism about the z-axis:

{V1, V2, V3, V4, V5, V6, V7, V8} = {{0, 0, 0}, {1, 0, 0}, {1, 2, 0}, {0, 2, 0}, {0, 0, 3}, {1, 0, 3}, {1, 2, 3}, {0, 2, 3}};
{V1p, V2p, V3p, V4p, V5p, V6p, V7p, V8p} = {{0, 0, 0}, {0, 1, 0}, {-2, 1, 0}, {-2, 0, 0}, {0, 0, 3}, {0, 1, 3}, {-2, 1, 3}, {-2, 0, 3}};

rules = {1 -> 2, 2 -> 3, 3 -> 4, 1 -> 4, 1 -> 5, 2 -> 6, 3 -> 7, 4 -> 8, 5 -> 6, 6 -> 7, 7 -> 8, 8 -> 5};

originalRect = GraphPlot3D[rules, 
                        PlotStyle -> {Dashed, Black},  
                        VertexCoordinateRules -> {1 -> V1, 2 -> V2, 3 -> V3, 4 -> V4, 5 -> V5, 6 -> V6, 7 -> V7, 8 -> V8}];

rotatedRect = GraphPlot3D[rules, 
                        PlotStyle -> Blue, 
                        VertexCoordinateRules -> {1 -> V1p, 2 -> V2p, 3 -> V3p, 4 -> V4p, 5 -> V5p, 6 -> V6p, 7 -> V7p, 8 -> V8p}];

Show[originalRect, rotatedRect, Boxed -> False, 
     ViewPoint -> {1, 1, 1}, Axes -> True, AxesOrigin -> {0, 0, 0}, 
     AxesLabel -> {"x", "y", "z"}, LabelStyle -> Directive[Red], 
     Ticks -> {Range[-10, 10], Range[-10, 10], Range[-10, 10]}, 
     TicksStyle -> Directive[FontOpacity -> 0, FontSize -> 0, Bold]]

Which gives the following graphic:

graph

So my question is why are the AxesLabels in weird places instead of directly above their respective axes?

$\endgroup$
3
  • 2
    $\begingroup$ Maybe this thread will help. $\endgroup$
    – corey979
    Sep 2 '16 at 19:15
  • $\begingroup$ @corey979 Thank you, that will work for my applications. I still am curious about why the AxesLabels built in don't work properly here though. $\endgroup$
    – J_Nat
    Sep 2 '16 at 19:32
  • 1
    $\begingroup$ MMA may have some logic in doing so. Notice that the x,y,z are visually in the same distance from their respective axes. If, i.e., y was above the axis (not under as it is now) it would be too close to x. In addition, I think that because MMA consists of an enourmous amunt of functions, options, possibilities etc. it has to be rather, idk, stiff as most options span a number of commands. Overall, I would treat it more as a feature than a bug. $\endgroup$
    – corey979
    Sep 2 '16 at 20:01

Your Answer

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

Browse other questions tagged or ask your own question.