Why does Arrow not work well with Scaled coordinates in 3D?

Bug introduced in 8.0 and fixed in 10.4 or earlier.

I am a little puzzled by the fact that if I try to use Arrow with Scaled coordinates in 3 dimensions the arrowheads are all over the place. Note Arrow should work with Scaled coordinates as it is mentioned in the relevant documentation. So while this:

pt2D = (Scaled /@ RandomReal[{0, 1}, {2, 2}]);


works fine:

Graphics@{Arrow@#}& @ pt2D


this:

pt3D = (Scaled /@ RandomReal[{0, 1}, {2, 3}]);


gives the arrowhead detached from the arrow:

Graphics3D@{Arrow@#}& @ pt3D


and the same thing happens with Tubed arrows. Here's one from the middle to the edge of a plot:

Show[Plot3D[Sin[x - y], {x, 0, 2 π}, {y, 0, 2 π}, PlotStyle -> Green],
Graphics3D[{Arrow[Tube[#]]}& @ {Scaled[{0.5, 0.5, 0.5}],Scaled[{1, 1, 1}]}], ImageSize -> 200]


Is this in any way expected behaviour? If not, can anyone recommend an easy fix?

• Ok, I can test it now and can confirm this. I do not see how it my be considered expected behaviour imo.
– Kuba
Apr 18 '14 at 16:10
• I think this is closely related to an issue I addressed on my web page some time ago. I agree with @Kuba that it's not expected behavior. If you want, I could post the arrow function from my web site as an answer...
– Jens
Apr 18 '14 at 16:18
• Since we seem to have agreement that this is not the expected behaviour I added the bugs tag. Apr 18 '14 at 16:40
• @Jens ah, I should have looked on your website before asking. If you can find the time that would be great but it's not a pressing issue - I was just puzzled by this.
– gpap
Apr 18 '14 at 18:02
• @gpap I just added an answer - my own approach was simply to avoid scaled coordinates as much as possible...
– Jens
Apr 18 '14 at 18:13

This is a bug which seems to be related to the fact that the foreshortening of the arrow is not scaled correctly with the end points of the arrow. The head and shaft of the arrow are treated separately, which may have some benefits (for example, it allows you to independently specify an option Appearance in Arrowheads that determines if the head appears projected in 3D or not). However, in this case, the scaling is out of sync. Strangely, this appears to happen only with the default arrow head.

So the simplest workaround (if you need to use scaled coordinates) is to define a custom arrow head:

Graphics3D[{Arrowheads[{{.01, 1,
Graphics3D[Cone[{{0, 0, 0}, {3, 0, 0}}]]}}],
Arrow[Tube[Scaled /@ {{0, 0, 0}, {.9, .9, .9}}]]}]


In 2D, the arrow head is a polygon, and you could use the following:

Graphics3D[{Arrowheads[{{.02,
1, {Graphics[
Polygon[
{{-1, 1/2}, {1/2, 0}, {-1, -1/2}, {-8/9, 0}, {-1, 1/2}}
]], 7/9}}}],
Arrow[Scaled /@ {{0, 0, 0}, {.9, .9, .9}}]}]


• Thanks! The reason I am using scaled coordinates is that it's really easier to annotate a plot with them. I have upvoted and plan to accept this. My only reservation is that if the plot range is a bit uneven weird things happen to the arrow head despite the scaling: Show[Plot3D[Sin[(x - y)/40], {x, 0, 30 π}, {y, 0, 30 π}], Graphics3D[{Arrowheads[{{.02, 1, {Graphics[Polygon[{{-1, 1/2}, {1/2, 0}, {-1, -1/2}, {-8/9, 0}, {-1, 1/2}}]], 7/9}}}], Arrow[Scaled /@ {{0, 0, 0}, {.9, .9, .9}}]}]] (this is not to do with your answer, it is happens anyway and is more prevalent with Tube)
– gpap
Apr 19 '14 at 13:24
• @gpap That's a great example, very entertaining... somebody at Wolfram really should re-think the way arrows wok in 3D. This internal use of Scaled for the heads causes so much headache.
– Jens
Apr 19 '14 at 16:28
• Yeah, I totally agree. This is entertaining until it becomes annoying methinks. In any case thanks a lot for your help
– gpap
Apr 19 '14 at 18:19