File Exchange

image thumbnail

3D Arrow with many color/parameter options

version 1.0 (77.5 KB) by

Create a single 3D arrow in a volumized format



No License

This code allows you to create simple, yet powerful three dimensional arrow. As it is derived from the surf command, it may be memory intensive, but well worth the cost for crisp visualization of data using phong shading and MATLAB's lighting options.

arrow3D([0,0,0], [0,0,1],'red',0.82);

%% Creates a single arrow starting at the origin with magnitude=1 along the z-axis, in red, with an arrowhead 18% of the length and the stem 82% of the length.
This has a 'published' file, so use:
  playshow demoArrow3D

to view many of the details or simply view directly the html file attached.

Comments and Ratings (6)

Michael Wang

There is a bug on line 71. It should be:

Otherwise, the base radius of the cone does not vary with the 'coneRadius' parameter above.

Also, it should be sufficient to use

incr = 1

on line 69

Thanks for the useful function

Jun Liu


Josh (view profile)


Maria (view profile)

Works fine. Although I would like to have more info/help.

John D'Errico

Nicely improved. This now deserves a 5 rating.

John D'Errico

Nice arrows. My only comment is that I'd prefer to see only two inputs, as vectors instead of 6 inputs. Thus you would call it as


This would seem generally easier to use programmatically, since most of the time this information is already in one vector anyway. For multiple arrows, supply an array.

Its a minor point, and purely style, so I'd otherwise leave my rating as a 5. I chose to downrate this to a 4 because the author forgot to include the meanings of the parameters in the help for this function. Yes, the demo file is very nice, and I like to see examples. But next year or next month when I want to use this code, I'll need to get help for it in matlab. This help is useless. Are Qx,Qy,Qz the end points of the arrow or the delta in each dimension? What are the explicit meanings for colorCode and stemRatio?

I actually wanted to rate this lower because of the poor included help, but I liked it enough to leave it as a 4. I'll hope the author chooses to upgrade the help. I'd also love to see a better H1 line. As it is, the function lookfor will never see this function, so next year when you want to use this code, you may not even find it anyway.

MATLAB Release
MATLAB 7.0.1 (R14SP1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video