File Exchange

image thumbnail

plot arrowhead

version 1.0 (2.47 KB) by

Simple and SMALL code for arrowhead plot.

4.13043
23 Ratings

17 Downloads

Updated

View License

% 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

Comments and Ratings (27)

Elad

Very nice!

Elad

M H

M H (view profile)

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

Sujin Wanchat

Oliver

Oliver (view profile)

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

wizy Bekele

Nice. Thanks.

Exactly what I needed for my thesis. Thanks!

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

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

Thanks for sharing

Shashank Mutha

works fine!

Edgar Guevara Codina

Very simple and fulfilled my requirements. Good job!

Joris D

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

Amy Haase

It works! Thanks

xiaolong zhang

helpful. but 3d should be considered.

Mehmet KOÇ

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

Gleb Tcheslavski

Thank's!!! It works flawlessly.

Ville Lilja

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

Siamak Faridani

awesome, besides I agree with Robert

Alex Ravetti

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

Daniele Marazzina

Robert Ghouhard

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

Robert Ghouhard

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

Ervin Durst

Produces awfully results if the axis are not scaled equally!

Hans-Peter Suter

Small is beautiful!

Very much appreciated, thanks a lot.

Moritz Harteneck

A useful simple function to add arrows to your plots.

MATLAB Release
MATLAB 6.1 (R12.1)
Acknowledgements

Inspired: CAD APPS , CADApps mechanics

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

» Watch video