Rank: 4233 based on 22 downloads (last 30 days) and 1 file submitted

Ryan Molecke


Personal Profile:


Watch this Author's files


Files Posted by Ryan Molecke
Updated   File Tags Downloads
(last 30 days)
Comments Rating
04 May 2010 Screenshot Arrow plotter very simple customizable inline function to draw arrows. Author: Ryan Molecke arrow, plotting, image processing, widgets, inline functions 22 1
Comments and Ratings by Ryan Molecke View all
Updated File Comments Rating
06 Dec 2010 BUBBLEPLOT3 A simple 3D-bubbleplot. Author: Peter (PB) Bodin

Thank you for this!

04 May 2010 arrow.m Draw a line with an arrowhead. Author: Erik Johnson

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]);

Comments and Ratings on Ryan Molecke's Files
Updated File Comment by Comments Rating
16 Jun 2011 Arrow plotter very simple customizable inline function to draw arrows. Author: Ryan Molecke Roger Parkyn

Nice and simple. Works OK if the xlimits and ylimits are across similar ranges. In such cases, or where plotting will be similar each call, this should be great. Otherwise the arrowhead shape is a bit unpredictable due to distortion.

I ended up going back to arrow.m (by Erik A. Johnson, it is on the file exchange. Yes that does look like a monster, at nearly 1400 lines!).

Contact us