File Exchange

image thumbnail

arrow

version 2.1.0.0 (58.2 KB) by Erik Johnson
Draw a line with an arrowhead.

249 Downloads

Updated 25 May 2016

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week Popular File 2012 2013

ARROW (5/25/2016) Draw a line with an arrowhead.

ARROW(Start,Stop) draws a line with an arrow from Start to Stop (points should be vectors of length 2 or 3, or matrices with 2 or 3 columns), and returns the graphics handle of the arrow(s). By itself, ARROW will use the mouse to allow selection.

ARROW DEMO & ARROW DEMO2 show 3-D & 2-D demos of the capabilities of ARROW.

ARROW PROPERTIES shows the properties that can be set (length, base angle, tip angle, width, which ends have arrowheads, etc.)

Comments and Ratings (211)

Jeff Harris

Erik Johnson

Antonietta: not sure what you mean. Can you elaborate? What version of MATLAB on what platform? Can you give some code to demonstrate your problem.

Yanqing Pan

Great function. Although I've encountered a different problem, the script seems to be working perfectly without any errors but the output figures keep disappearing. If anyone can help it would be immensely appreciated and have my eternal thanks.

sgreess

Takes some getting used to, but the comments are a huge help and once I got the hang of it, this was really useful. Thanks!

Marat Zhe

Marat Zhe

Marat Zhe

Marat Zhe

Erik Johnson

FYI, Shuliang's error went away when he reinstalled.

Ruizhao Zhu

Erik Johnson

Shuliang, It's not clear how that error could occur: there is no '*' operator on line 406 that is giving the error. Can you let me know what version of arrow you are using (look for the date on the Copyright line in the arrow.m code)? Please click on my name, click "view profile" and click on "Contact" to e-mail me.

Sorry, I also meet some problem(revision R2018b)
I tried Tomy's code for a trial and it shows:
Undefined operator '*' for input arguments of type 'matlab.graphics.axis.Axes'.
Error in arrow (line 406)
if ~isempty(crossdir),

Tomy Duby

Eric, Thanks! Yes, I was using an old version of arrow.m function (5/20/09). Downloading the latest version resolved the issue. So works fine on R2018a and even R2018b.

Erik Johnson

Tomy's error seems to be with a (very) old version of arrow (circa 2009) and should not occur with the current version. Let me know if otherwise.

Tomy Duby

Sorry, but does not work for me (revision R2108a):
x = 0:pi/100:2*pi;
y = sin(x);
figure
plot(x,y)
hold on
arrow( [0, 0], [1, 0] )
Undefined operator '*' for input arguments of type 'matlab.graphics.axis.Axes'.
Error in arrow (line 423)
ax = o * gca;

Perfect on 2014b

bigseat

Dage Shang

great function. works perfectly.

Thanks a lot. This script perfectly helps me with the problem of adjusting headsize of arrows when using quiver function.

Chuan He

% You may want to execute AXIS(AXIS) before calling ARROW so it doesn't change
% the axes on you; ARROW determines the sizes of arrow components BEFORE the
% arrow is plotted, so if ARROW changes axis limits, arrows may be malformed.

mcdull hall

Great work.
If someone needs to hide the arrow, it can be achieved by setting the XData and YData of the arrow handle (a patch obj) to empty arraies; to redraw the arrow, just use the function as arrow(h_arrow, 'Start',[x1 y1],'Stop',[x2 y2]), as mentioned in the m-file.
Thanks again.

Vojtech

It works well if you have some kind of nice axis limits. But otherwise you have to play with arrow appearance a lot..
Example: arrow([0 1e6],[1000 1e6]); - it doesnt produce an arrow one would expect..

Jack Lee

The arrow drawing works great, but before I called the function, I plotted two other curves and called the legend function to give them labels (just two labels). However, after calling legend I then call four arrows and they show up in the legend and I can't seem to exclude them. In the legend, the four arrows show up with the labels "data1", "data2", "data3", "data4". I can find no way to exclude them.

I'm using 2017a

I'm seeing some strange behavior when the renderer is painters where part of the tip angles up a little bit.

Shujaat Khan

Cheng Zeng

Very useful! I've had quite a bit of trouble with quiver() in the past since it's not meant to draw a shape so much as vectors, but this does the trick!

Note on axis limits: The warning "Warning: ARROW changed the axis limits when adding the arrow.
Call ARROW FIXLIMITS to reset them now." does not have a warning.identifier to allow it to be suppressed, but calling "axis(axis)" before using arrow() prevents the error from occurring.

arnold

I'm using this soooo much, however, it would be nice if you could add the ability for the arrows to always 'face' the camera, so that they're not flat in 3d space when rotating.

Yujiao Sun

Excellent documentation, and very useful packaged function!

tao lu

Erik Johnson

Friedhelm, It only happens in debugging? Can you email me some code? (Email address is in the m-file; or click on my name then "view profile" then "Contact".)

Dear Erik, I am running several Matlab versions (2016a, 2016b and 2017a) and the "strange behavior" is that the arrows are distorted in both, length and shape of the arrow head. Meanwhile I noticed that calling "arrow" in pointwise fashion (in a for-loop) and debugging the code step by step is causing the problem. If I avoid debugging then the problem disappears. Many thanks. Friedhelm

Erik Johnson

Can you describe the strange behavior? What MATLAB version? Can you provide a minimal working example to demonstrate it?

First of all, this is a great function, which I am using now for many years. Thanks! However, today I observed a strange behaviour after calling it twice (different figures) but with identical arguments and I wonder what the reason may be. The handle argument lists are identical. Any help would be highly appreciated. Thanks. Friedhelm Krumm

Alex Kotov

Paul

YUWEN LI

looks perfect

Cebri

Yiming Pan

Awesome work!

Michael

gusjammo

Fantastically good.

Nice!

Baoning Wu

With perfect control of properties, this is exactly what I want!

Jing Lou

Nice work!

Mohammed

Nice Job! Works well with my oldest version of MATLAB.

Here is my line of the code:
arrow(tStart,tStop,10,'Ends','Both','Width',1,'FaceColor','k','EdgeColor','k');

Both tStart an tStop are numerical parameters and pre-defined.

Rick

quan yuan

Erik Johnson

Daisuke, I've not seen this problem before. What version of MATLAB? Can you give a minimal working example to demonstrate it?

Daisuke

When I drew a vertical arrow, the line got off from the arrow head (see the url for a picture). Is there a way to fix this? If not, could you tell me how I could adjust this ?
https://drive.google.com/file/d/0B8e6a9ddS2_aTnBidW5sTVllZUk/view?usp=sharing

Erik Johnson

After a long hiatus, arrow has been updated for HG2 compatibility. I _think_ most of the comments below have been incorporated.

easywei

What's going on with this error:

views = get(ax(:),{'View'});

Error in arrow (line 961)
mask = arrow_is2DXY(oldaxlims(:,1));

Thanks anyone!

Works well on 8.6.0.267246 (R2015b) after putting in the exact changes that Johannes recommends (2 posts down). Before that it didn't work on my version but did on other matlab installs I have at school etc., getting the same error people are talking about.

Ken

Ooops, my bad. You must implement all of the suggestions by Justin and Brenton.

Johannes

For everybody that has problems running the current arrow.m version on newer Matlab versions, please follow the corrections suggested by Justin and Brenton from 11 Nov 2014. I adapted them on Matalb R2015a and it works....

Here the suggested changes copied from their posts:

Justin:
Previous: Line 423 ax = o * gca;
Update: ax = repmat(gca,narrows,1);

Previous: Line 590 curT = get(curax,'Xform');
Update: [azA,elA] = view(curax);
curT = viewmtx(azA,elA);

Brenton: Piggy-backing on Justin's edits, update with the following:

LINE 504: oldaxlims(min(find(oldaxlims(:,1)==0)),:) = [ii reshape(axl',1,6)];

LINE 960:
lims = get(ax(oldaxlims(:,1)),{'XLim','YLim','ZLim'})';

LINE 962:
mask = arrow_is2DXY(ax(oldaxlims(:,1)));

Amir Paster

It doesn't work in Matlab 2015a

>> arrow
Undefined operator '*' for input arguments of type 'matlab.graphics.axis.Axes'.

Error in arrow (line 423)
ax = o * gca;

ankit dixit

Moses

Thanks Justin and Brenton! I got it to work for MatLAB version 2015b following your edits.

As an alternative, there is now the DaVinci Draw toolbox, davinci-draw.com, which uses low-level Matlab commands like plot() and patch() to draw mid-level shapes like arrows. Example syntax:

davinci( 'arrow', 'X', [0 10], ...
'Y', [0 2], ...
'Shaft.Type', 'rectangle', ...
'Shaft.Width', 1, ...
'Head.Length', 2.5, ...
'Color', 'w', ...
'EdgeColor', 'k', ...
'LineWidth', 2.5 )

Johannes

Same here in 2015b, not working properly
>> arrow DEMO
Undefined operator '*' for input arguments of type 'matlab.graphics.axis.Axes'.

Error in arrow (line 423)
ax = o * gca;

Error in arrow>arrow_demo3 (line 1273)
h1 = feval(mfilename,[axlim(1) axlim(4) 4],[-.8 1.2 4], ...

Error in arrow (line 142)
hh=arrow_demo3(demo_info);

Zhigang Xu

Dear Author,

It seems that the ARROW cannot work with Matlab R2015a version. I got an error message as

Error in arrow (line 406)
ax = o * gca;

Can you fix it? Thanks!

Zhigang

Thank you Daniel Claes - that worked for me!

It is not mine, but I found a working version it on GitHub (works for 2015a):
https://raw.githubusercontent.com/stabix/stabix/master/third_party_code/arrow/arrow.m

Good contribution. Thanks!

Thank you for the preceeding comments. They helped making this otherwise excellent function work. 5 stars for the function. 0 stars for the slow updating. I strongly encourage the author update this function according to the comments made.

Thanks to Justin A., Brenton, and Bruce Elliott, I have got it to work as well (R2014b). This is much better than the built-in annotation.m.

Thank you for the comments - I've got it to work now too.

Erik

Thanks to the comments of Justin A., Brenton and Bruce Elliott, I got this fantastic file working for the arrows I needed in MATLAB R2014b. Author: please update this file to make it compatible with the new graphics system.

Barbara

Eli

did anyone manage to make
arrow DEMO
work with 2014b? would it be possible to upload an updated working version?

Thanks to Justin and Brenton for the recommended mods for R2014b. I have another set of related changes.

These changes will suppress warnings about use of the graphics object property "EraseMode", which is no longer used. I believe the only purpose of these lines was to temporarily change the EraseMode and then to reset it to its original value.

REMOVE LINES 1031, 1032, 1033, 1065:

oldArrowProps = {'EraseMode'};
oldArrowValue = get(H,oldArrowProps);
set(H,'EraseMode','background'); %because 'xor' makes shaft invisible unless Width>1

...
set(H,oldArrowProps,oldArrowValue);

Brenton

Piggy-backing on Justin's edits, update with the following:

LINE 504: oldaxlims(min(find(oldaxlims(:,1)==0)),:) = [ii reshape(axl',1,6)];

LINE 960:
lims = get(ax(oldaxlims(:,1)),{'XLim','YLim','ZLim'})';

LINE 962:
mask = arrow_is2DXY(ax(oldaxlims(:,1)));

Justin A.

Strike that. It works for one arrow, but not the demo.

Justin A.

I was able to get it to work in 2014b with 2 changes:

Previous: Line 423 ax = o * gca;
Update: ax = repmat(gca,narrows,1);

Previous: Line 590 curT = get(curax,'Xform');
Update: [azA,elA] = view(curax);
curT = viewmtx(azA,elA);

Yang Liu

@David, @Tobias, I have encountered the same issue.
Did you manage to resolve the problem? Thanks in advance!

David

Love this script, but it looks like there's a fundamental incompatibility with the new 2014b graphics system, in which gca no longer returns a number. Simply running the demo (arrow DEMO) returns the error:

Undefined function 'mtimes' for input arguments of type
'matlab.graphics.axis.Axes'.
Error in arrow (line 423)
ax = o * gca;

Nice function, but unfortunately it doesn't accept axes handle, like plot. In same cases, like Maltab GUI, one cannot just set the axes before making the plot.

Pete

I was a bit sceptical, but this is actually a very useful and well-documented function. Many thanks

Darien

You are brilliant. Thank you very much for your hard work and masterful technique.

Johan

Works nicely, but i did find a bug:
an exactly vertical arrow (from [0 0 0] to [0 0 1]) is plotted with a length of ~16 reaching far in the negative z-domain. Just type in
arrow([0 0 0],[0 0 1])
and see.

Does someone know a solution to this?

with kind regards,
Johan.

Peter Caday

@Li, after reading Rajib's comment below, I saw you can change color in one function call:

h = arrow(..., 'EdgeColor', 'g', 'FaceColor', 'g');

@Tobias, I don't have 2014b, but you could try replacing line 423 with:

ax = repmat(o, narrows, 1);

After updating Matlab to 2014b, arrow.m is not working. It is stopping in line 423 with the error:

Undefined function 'mtimes' for input arguments of type 'matlab.graphics.axis.Axes'.

Error in arrow (line 423)
ax = o * gca;

Can somebody please help me?

Terrific. Thanks.
For those of you who would like to have a small gap between the arrow and the start and end point (e.g. so as not to obscure a marker), I've written a slight update (note: not compatible with arrow.m properties directly, but you could easily adapt):

function [varargout] = my_arrow(start,stop)
arrow_gap_pc = 0.05; % defines gap size relative to size of initial arrow
d=stop-start;
dx=d(1);dy=d(2);dz=d(3);
[th,phi,r] = cart2sph(dx,dy,dz);
arrow_gap = arrow_gap_pc*r;
[x1,y1,z1] = sph2cart(th,phi,arrow_gap);
b = start+[x1 y1 z1];
e = stop-[x1 y1 z1];
ah = arrow(b,e);
if nargout == 1
varargout{1} = ah; end

I think this is one of the best functions I have ever stumbled upon. Thanks alot.

Yagiz

Li Zhang

Useful! How to change the color of the arrow ?

Alan

Jo Williams

Very useful, thanks. The help suggests using AXIS(AXIS) to fix the limits, I think the same effect can be acheived with AXIS MANUAL, which would be clearer.
It's also not obvious that the arrow will be a patch object, so has properties like edgecolor, facecolor, rather than line properties.

Jan Motl

Jan Valdman

Perfect!

Sisi Ma

I wrote the following code:

figure(1)
clf
hold on;
scatter3(X,Y,Z,'ko')
Z1 = 500;
arrow([max(X) max(Y) Z1],[min(X) min(Y) Z1],15,'BaseAngle',60, 'FaceColor',[0 1 0])

I want to make outputs (which must contain the line along with arrow head) in X-Z plane; i.e. view([180 0]), not in 3D which is good for visualization only. Unfortunately, though the line is visible, the arrow head is not seen when I go into 2D view. I tried to include 'CrossDir',[0 0 1] as suggested by the author of the script, but it didn't help. Any suggestion?

Michael Chan

How do you turn off the arrow heads at either ends of the start and stop points?

Matthew M.

Very helpful and thorough! I only have a couple of minor quibbles - 1) the author didn't make it totally clear what normal MATLAB line properties you should use to change the arrow color and arrowhead color. But it's not too hard to figure out. 2) The author didn't assign message identifiers to the warnings (like for changing the axis limits). I edited the function to add message identifiers so I could turn them off - don't need my Command Window cluttered up with a lot of orange text.

Ryan

Does anyone know how to add an arrow to the legend? I'm using arrow.m to draw arrows which represent data on the plot and it would be helpful to have a blue arrow in the legend.

Kent Leung

@Matthias, I had this problem too and just stumbled on a solution. (In fact, the problem for me was that the xlabel was disappearing.) To fix this I did:

ax1=subplot(2,1,1); [...]
axes(ax1); arrow([x1 y1],[x2 y2]); arrow fixlimits;

I always do "fixlimits" just in case. The reason I tried this was because in the help file:
"You may want to execute AXIS(AXIS) before calling arrow so it doesn't change the axes on you; arrow determines the sizes of arrow components BEFORE the arrow is plotted, so if arrow changes axis limits, arrows may be malformed."

It's not obvious that this fixed the subplot resizing problem, but it worked!

Felix

By far the easiest way to draw arrow compared with arrow3.m and mArrow3.m.

Generally works fine. However, I use subplots, e. g. 3 x 2, and some of them have arrows. Now the arrows change the size of the subplot so that the subplots are no longer of equal size. Any idea how to correct that?

ATN

How do I make the arrows dashed, and make the color for each arrow different, corresponding to its z value?

Adding the 'Linestyle',':' for dashed line option makes the arrows look rather strange.

For the colors, I tried creating an nx3 matrix lineColors where each row is a color for the corresponding element, and added the option " 'EdgeColor',lineColors ", but got an error:

"Color value must be a 3 element numeric vector"

Any help is appreciated. Thanks.

Yuanye Wang

exactly what I need. thanks a lot.

Tobias

Regarding W & Jacopo,

setting the view before the arrow functions solves your problem e.g.:

clc; clear; close all

xvector=[1 0 0];
yvector=[0 1 0];
zvector=[0 0 1];

figure
grid on
daspect([1 1 1])
xlabel('x [mm]', 'FontWeight', 'bold')
ylabel('y [mm]', 'FontWeight', 'bold')
zlabel('z [mm]', 'FontWeight', 'bold')

%Here goes the view setting
view([1 1 1])

arrow([0 0 0],xvector, 'EdgeColor','k','FaceColor','k')
arrow([0 0 0],yvector, 'EdgeColor','b','FaceColor','b')
arrow([0 0 0],zvector, 'EdgeColor','r','FaceColor','r')

%Not here
%view([1 1 1])

Don't no why but seems to work!

BW,
Tobi

John Colby

Wonderful. Thank you, Erik!!!

Kuifeng

Jacopo

> Christopher This code, at least on >R2009a, looks very strange.
>close all; clc;
>figure(1)
>arrow([0;0;0],[1;0;0])
>arrow([0;0;0],[0;1;0])
>arrow([0;0;0],[0;0;1])
>axis([-1 1 -1 1 -1 1])
>I'm really having trouble with 3-D plots >and arrows pointing along the 3rd axis.

I got the same problem on Matlab R2010a (7.10.0)

Will

Using arrow with this script yields an unusually long arrow in the z direction, which is quite annoying. I wish the z arrow didn't become long.

clc; clear; close all

xvector=[1 0 0];
yvector=[0 1 0];
zvector=[0 0 1];

figure
grid on
daspect([1 1 1])
xlabel('x [mm]', 'FontWeight', 'bold')
ylabel('y [mm]', 'FontWeight', 'bold')
zlabel('z [mm]', 'FontWeight', 'bold')
arrow([0 0 0],xvector, 'EdgeColor','k','FaceColor','k')
arrow([0 0 0],yvector, 'EdgeColor','b','FaceColor','b')
arrow([0 0 0],zvector, 'EdgeColor','r','FaceColor','r')
view([1 1 1])

Help would be greatly appreciated.

This is great, I messed around with the annotations for 1.5 hours before finding this. Once I found it everything was working the way I wanted it to in a couple of minutes. Great Work!

Perfect. Just what I was needing.

Zhibo

Very nice utility function. I just wonder if it is possible to fix the arrow head size so that it does not change with axis- zoom or resize. Thanks!

Really useful, thanks!

Thanks :)

Arthur

Very nice, thanks

guizhi

can this function specify the 'LineStyle', such as '-' , '--' , '-.' , and ':'?
how to do?
thank you.

thanks a lot. I was trying to make a arrow in a gui window. was having difficulty in correctly saving the arrow location. using your code it works perfectly :)

CC

Overall, the script is very useful. However, when using this arrow script, the legend is messed up. Some of the legend symbols would show as "black" squares instead of the correct symbol. When the arrow script is not used, the legend is displayed correctly.

Could anybody please let me know the following:

1. How to change the size of the arrow?
2. Please let me know how to change the type of the arrow head.
3. If possible, please let me know how to have arrow at both the head and tail of the vector.
4. Instead of arrow, please let me know how I can have a dot at both ends of the vector?
5. How to change the line type?

Thanks.

ben harper

can you please include the color options that you write on these comments to the code help lines
thank you

perfect!

Notan

Works great, but the Arrowtips do not look perfect by default as they are the connection of two line ends and therefore not round in pdf printouts.
You can workaround this issue by drawing the arrow in the opposite direction and use parameter: 'End','start'.
But nonetheless it would be nice if they would be perfect by default ;-)

David

THANK YOU!!!!

Christopher

This code, at least on R2009a, looks very strange.
close all; clc;
figure(1)
arrow([0;0;0],[1;0;0])
arrow([0;0;0],[0;1;0])
arrow([0;0;0],[0;0;1])
axis([-1 1 -1 1 -1 1])

I'm really having trouble with 3-D plots and arrows pointing along the 3rd axis.

Ryan Molecke

I found this implementation to be slow and lacking. Admittedly I was drawing thousands of arrows at extremely short lengths. Here is an inline function I wrote in about 5 minutes to draw simple arrows.

function out = draw_arrow(startpoint,endpoint,headsize)
%by Ryan Molecke

v1 = headsize*(startpoint-endpoint)/2.5;

theta = 22.5*pi/180;
theta1 = -1*22.5*pi/180;
rotMatrix = [cos(theta) -sin(theta) ; sin(theta) cos(theta)];
rotMatrix1 = [cos(theta1) -sin(theta1) ; sin(theta1) cos(theta1)];

v2 = v1*rotMatrix;
v3 = v1*rotMatrix1;
x1 = endpoint;
x2 = x1 + v2;
x3 = x1 + v3;
hold on;
% below line fills the arrowhead (black)
fill([x1(1) x2(1) x3(1)],[x1(2) x2(2) x3(2)],[0 0 0]);
% below line draws line (black)
plot([startpoint(1) endpoint(1)],[startpoint(2) endpoint(2)],'linewidth',2,'color',[0 0 0]);

Rob Campbell

Useful in many ways but the code is very complicated and it's not clear how to attain specific effects without trawling through the function body. Why not put demo code in a separate file?

Aamir

Aamir

It looks really great...I'll start use instead of quiver!

amazing,very useful

The arrowheads look distorted. Even the arrowheads in the demo look distorted.

Jianbo

Excellent. One little problem is that the arrow created is a little different from the one inserted manually through the "insert" menu. For example, the position can not be adjust by mouse.

Hiram

to set the color of the arrow, see this example:
axis([0 3 0 3 0 3]);
grid on
h=arrow([3 3 3],[0 0 0],36,'BaseAngle',60);
set(h, 'FaceColor', 'b');
set(h, 'EdgeColor', 'r');
Awesome application!

Ke

very useful.

Saeed Taherion

Leonardo Duarte

lili kalmer

Joselito Dimayuga

the purpose of this Dir or format is for ?????

Dmitry Vasilyev

OMG! Just exactly what I was looking for! Excellent job, thank you Eric!

GDR! x

One can change the colour of an arrow by specifying 'FaceColor' and 'EdgeColor' properties, which is, unfortunately, not documented.

Xuzhang Shen

good

Alex Fard

Matthijs Klomp

Works great.

Tuan Hoang

sorry, how to add this graphic handle (return value) to an existing axes, figure.

Ahmet Sacan

Does not work when called in a deployed application (i.e., when called from the executable generated using mcc).

Rutty Bee

Ruins the figure when plotting 3-D arrows with z-components. In this case, the width of the arrowhead becomes so large that the plot is rendered unusable. This is the case no matter how one tries to set its size.

Dustin Kruse

works perfectly

Jorge Marin

B Gurt

Does exactly what it needs to do.

jonny e

Excellent and easy to use. I'd emphasize that one should call axis(axis) prior to plotting the arrow, or the axis limits will get reset which will render the arrow incorrectly. This is noted in the help, but tucked towards the bottom.

Ramesh Rajasekaran

Vassili Pastushenko

does not point to (1,1)

Vassili Pastushenko

Good job. A small remark:

arrow([0 0],[1 1],50,10,30)

does not point to (0,1).

Probably it would be reasonable to add a feature of automatical swapping baseAngle and tipAngle, if baseAngle < tipAngle.

Arun Karthi Subramaniyan

Great tool. Very easy to use with detailed documentation. Thanks for sharing it with us.

J Xu

this program is really good, easy-use. 3x Erik.

Nithya C.R.

The program is really great with all the aspects of plotting a directed line excellently covered.

heath kitson

thanks eric

JR P

This is great. I hate how MATLAB uses normalized figure coordinates in their annotation() call for drawing arrows. It makes no sense and someone at MathWorks got lazy, so it becomes nearly useless. This code is exactly what they should have done.. good job Erik!

Jasper Menger

Nicely done. A shame by the way Matlab doesn't seem to have a builtin function for drawing arrows from the command line.

Very satisfied

Exactly what I needed. Perfect!

super tanne

Shane Lin

I add the following comment at the file head. arrow(Start,Stop,'EdgeColor','b','FaceColor','b') color arrow.

Vijaykumar Sathyamurthi

Thanks for this excellent tool. I hope you continue writing such winderful codes!!!

Sharoni Shafir

Works great, thanks!

Amit Kesar

Very good. Thank you.

Changshun Deng

Good script!

Dave Cogdell

This code (specifincally including the documentation (which is at the same time incomplete and inadequate) is far too complex for the simple thing(s) it does. I believe the author is an engineer: he should refrain from trying to write like a computer scientist and write like an engineer.

Janik Zikovsky

Very good, better than annotation('arrow') because it is in axis units!

Ian Mackenzie

Evan Westwood

Couldn't figure out how to make the arrow line and arrow head have a specific color. Arrowheads didn't look as nice as those you might plot in drawing/presentation packages such as Powerpoint.

Rattikan Saelim

Nathaniel de Lautour

Superb effort. Highly configurable, easy to use and well documented to boot.

Olivier Marsden

Very useful!

Eddie Fiorelli

Excellent work, thorough documentation. Thanks!

Mattias Forsblom

Excellent.

Kelvin Rocha

Very useful. Explanations are excellent. Exactly what I was looking for.

Gerald Dalley

Very nice

ke wang

Very Useful and convenient. Easy to use!!

Arnd-Ragnar Rhiemeier

Excellent package. Help topics very comprehensive. Easy to use. Quickly leads to appealing graphical output. This package is exactly what I was looking for.

Bernhard Boeck

That's exactly what I'm looking for

Benedikt Halldorsson

Neat package, but (unless I'm missing something obvious) renders itself essentially USELESS.
Try setting the linestyle of the arrow line to dotted (set(h,'linestyle',':') and then try printing it out to a file (print -depsc test.eps) and view the postscript image. The line certainly is not dotted (on Matlab 6.5). Same problem with dashed and dot-dashed lines.
I'm not sure if this is an arrow.m problem, or Matlab's.

Jakob van de Laar

Great package, it should be incorporated in
the standard Matlab distribution

M Bakht

It is just great. Amazing.

Niclas Borlin

Great!

Aslak Grinsted

a c

greatest function ever!

Updates

2.1.0.0

Added a 'Color' property (that sets both 'EdgeColor' and 'FaceColor' for arrows drawn with patch objects [the default]) and documentation of how to use it.

2.0.0.0

Updated for HG2 (R2014b and later)

1.2.0.0

actually update the file (not just the description); correct view on demo

1.1.0.0

Replace "eval('trycmd','catchcmd')" with "try, trycmd; catch, catchcmd; end;", which break's compatibility with MATLAB 5 but improves compliance with newer versions.

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor