3.94118

3.9 | 17 ratings Rate this file 213 downloads (last 30 days) File Size: 2.47 KB File ID: #3345

plot arrowhead

by Ohad Gal

 

27 Apr 2003 (Updated 19 May 2003)

Code covered by BSD License  

Simple and SMALL code for arrowhead plot.

Download Now | 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 (18)
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  
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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com