Annotation pinned to axes
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
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.