# Arrows on axes in Plot3D

I use the following code to draw arrows on arrows in 2D graphics:

Plot[Sin[x],{x,-10,10},AxesStyle->Arrowheads[Automatic]]


But such code doesn't work with Plot3D[…] and 3D graphics.

Is there any way to get axes with arrows on 3D graphics?

-
See this math.se question for a way to plot axes with arrows in 3D plots. I'm not posting this as an answer, because I don't think it sufficiently addresses the larger issue at hand — that of being able to conveniently use arrows while at the same time retaining all the functionality of individual axes styling, automatic tick marks, etc. that the *Style functions provide. –  The Toad Mar 10 '12 at 18:35

Here is a simple way to do this:

arrowAxes[arrowLength_] :=
Map[{Apply[RGBColor, #], Arrow[Tube[{{0, 0, 0}, #}]]} &,
arrowLength IdentityMatrix[3]]


This function draws three axes with arrows. To apply it:

Graphics3D[{Sphere[], arrowAxes[3]}]


This doesn't have axis labels, though.

To add labels by leveraging the built-in axes, one compromise (to save the work of making all labels by hand) would be to do the following:

Graphics3D[{Sphere[{1, 1, 1}], arrowAxes[3]}, Axes -> True,
Boxed -> False, AxesOrigin -> {0, 0, 0}, AxesStyle -> Opacity[0],
TicksStyle -> Opacity[1]]


Edit In my attempt at a labeled set of axes above, I deliberately set the axes to be invisible but left the ticks visible. You may find it more visually consistent to keep the default axes visible, together with the new 3D arrow-axes. For this, one could replace AxesStyle above with this: AxesStyle -> MapThread[RGBColor, IdentityMatrix[3]].

-
The ticks and labels are shining through the sphere... –  Sjoerd C. de Vries Mar 10 '12 at 18:53
They would with the standard axes, too. It's the default... I don't like it, either. Actually, one could say that this compromise is also an "improvement" over the default because at least the axes aren't shining through, so the viewer still has the numerical information about the ticks but also gets better visual cues as to the perspective. Anyway, the other option would be to go all the way and do the labels by hand, I guess. –  Jens Mar 10 '12 at 18:55
Is it really necessary to hide the axes? –  Sjoerd C. de Vries Mar 10 '12 at 19:01
No, of course that's a matter of taste. I edited my answer to take your suggestion into account. –  Jens Mar 10 '12 at 19:07