Why can I not set the 'Position' of the 'textbox' based on a specific axis?

I have a figure with an image, and I would like to create a textbox annotation and position it based on the figure's axes. I use the following code to achieve this:
figure;imagesc
ax_sa = gca
hTextEnd = annotation('textbox', ...
'Position',[0.3 0.3 0.5 0.5],...
'FitBoxToText','on','String',' End','Color','g','FontSize',16,...
'FaceAlpha',1.0,'EdgeColor','w','BackgroundColor','w');
set(hTextEnd,'Parent',ax_sa);
Why does MATLAB not consider the 'set' statement and position the textbox based on the axis?

 Accepted Answer

The 'Parent' property of the annotation cannot be explicitly set. This property of the annotation is hidden and does not work the same way as other objects do.
Annotations are positioned based on the figure and cannot be positioned based on a specific axes.
More information about the 'Position' property can be found in the MATLAB Documentation link below:

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Release

R2015b

Community Treasure Hunt

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

Start Hunting!