View License

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

» Watch video

Highlights from
plot arrowhead

4.1 | 23 ratings Rate this file 14 Downloads (last 30 days) File Size: 2.47 KB File ID: #3345 Version: 1.0
image thumbnail

plot arrowhead


Ohad Gal (view profile)


27 Apr 2003 (Updated )

Simple and SMALL code for arrowhead plot.

| Watch this File

File Information

% plot_arrow - plots an arrow to the current plot
% format: handles = plot_arrow( x1,y1,x2,y2 [,options...] )
% input: x1,y1 - starting point
% x2,y2 - end point
% options - come as pairs of "property","value" as defined for "line" and "patch"
% controls, see matlab help for listing of these properties.
% note that not all properties where added, one might add them at the end of this file.
% additional options are:
% 'headwidth': relative to complete arrow size, default value is 0.07
% 'headheight': relative to complete arrow size, default value is 0.15
% (encoded are maximal values if pixels, for the case that the arrow is very long)
% output: handles - handles of the graphical elements building the arrow
% Example: plot_arrow( -1,-1,15,12,'linewidth',2,'color',[0.5 0.5 0.5],'facecolor',[0.5 0.5 0.5] );
% plot_arrow( 0,0,5,4,'linewidth',2,'headwidth',0.25,'headheight',0.33 );
% plot_arrow; % will launch demo


This file inspired Cad Apps and Cad Apps Mechanics.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (27)
24 Jun 2012 Elad

Very nice!

Comment only
24 Jun 2012 Elad

22 Feb 2012 M H

M H (view profile)

Small bug: arrow for 270 deg (e.g. [0,0] to [0,-1]): Arrow-head points wrong direction (upwards).

Comment only
29 Jan 2012 Sujin Wanchat

19 Jul 2011 Oliver

Oliver (view profile)

Very nice file! But an absolut value for headwidth and headheight would be usefull.

15 Dec 2010 wizy Bekele

Nice. Thanks.

24 Feb 2010 Michael Stachowsky

Exactly what I needed for my thesis. Thanks!

05 Feb 2010 Cesar Chillon

29 Dec 2009 Jelena Radlovi?

Works great. I'm using Matlab 7.7 and it works without any problem. Thanks for sharing.

Comment only
19 Feb 2009 Carlos Martinez-Ortiz

10 Feb 2009 Emile Demarteau

This is the function I was looking for. Great work. Makes plotting arrows a piece of cake.

Thanks for sharing

07 Oct 2008 Shashank Mutha

works fine!

18 Jun 2008 Edgar Guevara Codina

Very simple and fulfilled my requirements. Good job!

29 Mar 2008 Joris D

Bug: max of head width is not calculated with max_width but max_length

10 Mar 2008 Amy Haase

It works! Thanks

28 Nov 2007 xiaolong zhang

helpful. but 3d should be considered.

07 Aug 2007 Mehmet KOÇ

Well. It's a good program. But do it could be done not only for 2D but also for 3D. well done.

04 Apr 2007 Gleb Tcheslavski

Thank's!!! It works flawlessly.

21 Nov 2005 Ville Lilja

It seems that arrows are not displayed correctly when the axis are scaled (So you must have axis equal or something)

13 Oct 2005 Siamak Faridani

awesome, besides I agree with Robert

16 Jun 2005 Alex Ravetti

I am a matlab newbie but I really needed that. Simple, nice and perfect, what do we need more ?

15 Feb 2005 Daniele Marazzina

17 Dec 2004 Robert Ghouhard

A interesting little routine. Shame Matlab doesnt have somthing like this as standard.

17 Dec 2004 Robert Ghouhard

A interesting little routine. Shame Matlab doesnt have somthing like this as standard.

Comment only
23 Sep 2004 Ervin Durst

Produces awfully results if the axis are not scaled equally!

05 Jun 2004 Hans-Peter Suter

Small is beautiful!

Very much appreciated, thanks a lot.

23 Mar 2004 Moritz Harteneck

A useful simple function to add arrows to your plots.

Contact us