Annotation pinned to axes

This function extends the standard annotation function by making them pinned to the axes.
1.1K Downloads
Updated 16 Aug 2011

View License

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')

Cite As

Fred Gruber (2024). Annotation pinned to axes (https://www.mathworks.com/matlabcentral/fileexchange/32536-annotation-pinned-to-axes), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

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

1.0.0.0