Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way of annotating multiple plots using arrows with code in MATLAB?

When doing multiple plots on the same figure in MATLAB, is there any way of annotating them such that the legend entries have arrows pointing to the plots that they're named for?

Here's an example of what I have in mind. I'd like to do this using code.

enter image description here

Note that the MATLAB website mentions a way to do this using the annotation function. The problem with that function is that it takes x and y values (normalized for the plot) and puts the text there. Given that I am not certain where the datapoints will lie, this is unhelpful for what I want to do.

I don't mind if the text shows up at a random place, actually. What's important is to have an arrow or some way of pointing to the plot that it is referencing.

like image 860
eqb Avatar asked Dec 02 '25 10:12

eqb


1 Answers

Take a look at the following Math works file exchange post:

http://www.mathworks.co.uk/matlabcentral/fileexchange/10656-data-space-to-figure-units-conversion

The code given here allows you to convert between data-space units and normalised figure units. The example given in the post seems to be doing almost exactly what you are asking.

like image 161
Huggzorx Avatar answered Dec 04 '25 02:12

Huggzorx