Code covered by the BSD License  

Highlights from
plot arrowhead

4.09091

4.1 | 22 ratings Rate this file 81 Downloads (last 30 days) File Size: 2.47 KB File ID: #3345
image thumbnail

plot arrowhead

by Ohad Gal

 

27 Apr 2003 (Updated 19 May 2003)

Simple and SMALL code for arrowhead plot.

| Watch this File

File Information
Description

% 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

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (24)
23 Mar 2004 Moritz Harteneck

A useful simple function to add arrows to your plots.

05 Jun 2004 Hans-Peter Suter

Small is beautiful!

Very much appreciated, thanks a lot.

23 Sep 2004 Ervin Durst

Produces awfully results if the axis are not scaled equally!

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.

15 Feb 2005 Daniele Marazzina  
16 Jun 2005 Alex Ravetti

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

13 Oct 2005 Siamak Faridani

awesome, besides I agree with Robert

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)

04 Apr 2007 Gleb Tcheslavski

Thank's!!! It works flawlessly.

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.

28 Nov 2007 xiaolong zhang

helpful. but 3d should be considered.

10 Mar 2008 Amy Haase

It works! Thanks

29 Mar 2008 Joris D

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

18 Jun 2008 Edgar Guevara Codina

Very simple and fulfilled my requirements. Good job!

07 Oct 2008 Shashank Mutha

works fine!

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

19 Feb 2009 Carlos Martinez-Ortiz  
29 Dec 2009 Jelena Radlovi?

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

05 Feb 2010 Cesar Chillon  
24 Feb 2010 Michael Stachowsky

Exactly what I needed for my thesis. Thanks!

15 Dec 2010 wizy Bekele

Nice. Thanks.

19 Jul 2011 Oliver

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

29 Jan 2012 Sujin Wanchat  
Please login to add a comment or rating.
Updates
19 May 2003

handle division by zero case,
fixed bug, which made the arrowhead flip at some angles

Tag Activity for this File
Tag Applied By Date/Time
annotation Ohad Gal 22 Oct 2008 07:00:35
customization Ohad Gal 22 Oct 2008 07:00:35
plot Ohad Gal 22 Oct 2008 07:00:35
graphics Ohad Gal 22 Oct 2008 07:00:35
arrowhead Ohad Gal 22 Oct 2008 07:00:35
arrow Ohad Gal 22 Oct 2008 07:00:35
arrow Matthew 23 Oct 2009 15:44:54
arrowhead Miguel 27 Jul 2010 15:06:23
arrow Peter Cotton 02 Dec 2010 13:36:23
arrow Steve Juranich 22 Jun 2011 11:46:10
plot_arrow Sylvain 20 Jul 2011 08:28:15
plot_arrow Felix 07 Nov 2011 14:01:58
annotation Amin merati 02 Jan 2012 12:54:23
annotation Andreas 10 Jan 2012 09:57:26

Contact us at files@mathworks.com