2

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

Tony
  • 1,020
  • 6
  • 17

2 Answers2

6

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.

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
Edmund
  • 42,267
  • 3
  • 51
  • 143
3

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!

Alexei Boulbitch
  • 39,397
  • 2
  • 47
  • 96