Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot arrow with data coordinates in Matlab?

Tags:

I know there is a function named annotation can plot arrows or double arrows. But annotation can only plot in normalized unit. For example:

annotation('arrows',[x1 x2],[y1 y2]) 

Here, [x1, x2] should be a ratio number less than one.

So, my question is how can I plot arrows with a true value rather than a normalized value?

I wonder if there is any other function can approach this or is there any function I can get the axis value of the figure so that I can adjust the true value into a normalized value.

like image 819
datcn Avatar asked Jul 16 '12 06:07

datcn


1 Answers

For the positioning of annotations, Matlab offers the function dsxy2figxy to convert data space points to normalized space coordinates. However, for whatever reasons, the function is not included in the Matlab distribution and has to be "created" first.

Copy the following line into the command window and execute it to open the function in your editor.

edit(fullfile(docroot,'techdoc','creating_plots','examples','dsxy2figxy.m')) 

To use the function dsxy2figxy save it somewhere in your matlab search path.

Please find the full instructions for the function dsxy2figxy at matlab-central: http://www.mathworks.de/help/techdoc/creating_plots/bquk5ia-1.html

like image 110
H.Muster Avatar answered Sep 19 '22 11:09

H.Muster