Method -> {"AxesInFront" -> False} for Graphics3D



I'm aware of two ways to manage positioning of Axes for Graphics3D: AxesOrigin and AxesEdge. They seem to be quite different in terms of what is actually happening:

             Graphics3D[##, AxesOrigin -> {0, 0, 0}], 
             Graphics3D[##, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}}]
            } &[Sphere[{1, 1, 1}, 1], Axes -> True, ViewPoint -> {5, 7, 3}]]

enter image description here

I want the graphics elements to be up front.

For axes being a part of the box it is natural to use AxesEdge since it gives me that effect.

However sometimes I want the axes origin to be inside the box. AxesEdge is useless and AxesOrigin creates strange effect:

Graphics3D[{Opacity@1, Sphere[{1, 1, 1}, 1]}, Axes -> True, AxesOrigin -> {1, 1, 1}]

enter image description here

Axes created with AxesOrigin seem to be different object than with AxesEdge. It looks like some kind of 2D projection in front of 3D graphics while AxesEdge creates something which is part of 3D graphics.

As one may know there (..find undocumented options...) is an undocumented option Method -> { "AxesInFront" -> False } to deal with this issue in $2D$ graphics.

It doesn't seem to work in $3D$. So my question is if anyone is aware of, maybe undocumented, option responsible for that.

If this is a projection it could be behind the Graphics3D objects too, couldn't it be? (that's a little bit naive, in form, question since I do not know much about graphics rendering etc)

P.s. I do not expect answers like "You can use FindDivisions+Line" etc. I'm looking for simple and fast solution. Or an answer that there isn't any. (spelunking appreciated too:))


Posted 2013-09-12T07:38:15.673

Reputation: 129 207

fyi, I do not get the same image in your first draw. I get this Mathematica graphics (on winows 7, V 9.01)

– Nasser – 2013-09-12T08:09:15.680

1@Nasser done. try now. – Kuba – 2013-09-12T08:13:37.263

3spelnuking - is that when you nuke your spelling? – Simon Woods – 2013-09-12T15:05:04.417

1@SimonWoods ehh. one could just check my posts looking for funny typos and it would be all week long game :P Thanks. – Kuba – 2013-09-12T15:06:38.483

Related: Arrows on axes in Plot3D

– Jens – 2013-09-13T04:03:31.483



If I understand correctly, in the case of your sphere you'd like the sphere to obscure your axes and ticks, except perhaps for a little bit where they poke out at the edges.

This isn't currently possible without writing your own axes using Line and Inset.

The "AxesInFront" and other "...InFront" method options only apply to Graphics which doesn't have a natural $z$-order.

Brett Champion

Posted 2013-09-12T07:38:15.673

Reputation: 19 284

Hello, I believe we haven't talk ever before. Ok, judging by you profile it seems to be a final answer. :) But let me ask you about some detailas or the refference about my thoughts about nature of axes in graphics3D, do not leave me with only intuitive understanding. :) – Kuba – 2013-09-13T05:12:49.637

And yes, you understand correctly. Also, forgive me my curiosity, but the fact you have written ""AxesInFront" and other "...InFront" options", while here we are aware of only Axes and GridLines, 'forces' me to ask about some 'other' examples :) – Kuba – 2013-09-13T06:17:43.590

3There's also "FrameInFront" but you're much less likely to run into cases where it might be useful. – Brett Champion – 2013-09-13T15:44:07.430