2
$\begingroup$

I am trying to plot a cuboid without box using Graphics3D, however the y-axis looks ugly, "floating" above the cube. The y-axis should join the other two at the origin. Thank you!

Graphics3D[{RGBColor[113/255, 190/255, 236/255], Cuboid[{0, 0, 0}]}, 
 Axes -> True, PlotRange -> {{0, 2}, {0, 2}, {0, 2}}, Boxed -> False]

enter image description here

$\endgroup$
1

2 Answers 2

6
$\begingroup$

If you do not want to axes to dynamically redraw themselves to stay in view as you rotate then you can use AxesEdge to fix their location.

Graphics3D[{RGBColor[113/255, 190/255, 236/255], Cuboid[{0, 0, 0}]},
 Axes -> True, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}},
 PlotRange -> {{0, 2}, {0, 2}, {0, 2}},
 Boxed -> False]

enter image description here

But in this case the default viewpoint hides the axes. Either rotate or use ViewPoint.

Graphics3D[{RGBColor[113/255, 190/255, 236/255], Cuboid[{0, 0, 0}]},
 Axes -> True, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}},
 PlotRange -> {{0, 2}, {0, 2}, {0, 2}},
 ViewPoint -> {2, 2, 2},
 Boxed -> False]

enter image description here

Hope this helps.

$\endgroup$
1
  • $\begingroup$ ViewPoint -> {2, 2, 0.5} is a little better, actually. $\endgroup$
    – Edmund
    Commented Jan 24, 2016 at 16:30
3
$\begingroup$

You may also do like this:

    Graphics3D[{RGBColor[113/255, 190/255, 236/255], Cuboid[{0, 0, 0}]}, 
 Axes -> True, PlotRange -> {{0, 2}, {0, 2}, {0, 2}}, Boxed -> False, 
 AxesOrigin -> {0, 0, 0}]

enter image description here

and like this:

    Graphics3D[{RGBColor[113/255, 190/255, 236/255], Cuboid[{0, 0, 0}], 
   Red, Thick, Line[{{0, 0, 0}, {2, 0, 0}}], 
   Line[{{0, 0, 0}, {0, 2, 0}}], Line[{{0, 0, 0}, {0, 0, 2}}]}, 
  Axes -> False, PlotRange -> {{0, 2}, {0, 2}, {0, 2}}, 
  Boxed -> False] /. Line -> Composition[Arrow, Tube]

enter image description here

Have fun!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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