Code covered by the BSD License  

Highlights from
Annotation pinned to axes

4.66667

4.7 | 3 ratings Rate this file 12 Downloads (last 30 days) File Size: 3.18 KB File ID: #32536
image thumbnail

Annotation pinned to axes

by Fred Gruber

 

14 Aug 2011 (Updated 16 Aug 2011)

This function extends the standard annotation function by making them pinned to the axes.

| Watch this File

File Information
Description

I needed to be able to create annotations to plots that would be pinned to the axes like the text function. I couldn't find any script to do this so I made my own. I though other people may find it useful.

The only difference in use with the annotation function is that you can provide the axes handle. For example:
 figure
 ah1=subplot(2,1,1);
 annotation_pinned('textarrow',[0.6,0.7],[0.3,0.5],'String','simple text','Interpreter','Latex')
 ah2=subplot(2,1,2);
annotation_pinned('arrow',[0.1,0.2],[0.5,0.1],'axes',ah1);
annotation_pinned('textarrow',[0.3,0.5],[0.3,0.5],'axes',ah2,'String','test $x^2$','Interpreter','Latex')

MATLAB release MATLAB 7.12 (R2011a)
Tags for This File  
Everyone's Tags
annotation, arrow, pin to axes, textarrow
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
03 Feb 2013 Oscar Márquez

I can´t use this script beyond the limits 0-1. I tried:
>> close all
>> x=0:200; y=x; plot(x,y)
>> annotation('textarrow',x_to_norm_v2(0,50),y_to_norm_v2(50,50),'String','String')

y_scale =

linear

>> annotation_pinned('textarrow',x_to_norm_v2(0,50),y_to_norm_v2(50,50),'String','String')

y_scale =

linear
The result is not the same, the script for pinned annotation places the annotation in a wrong place if you are using axes bigger than normalized .
How can I solve this?

30 Aug 2012 li  
06 Jun 2012 kevin  
Updates
16 Aug 2011

just added another line to example to show that if you don't specify the axis then it uses the current axes

Contact us