How can I plot annotation text data by means of a MATLAB file on a 3-D figure plot in MATLAB 6.5 (R13)?

3 views (last 30 days)
I am trying to plot annotation text data by means of a MATLAB file on a 3-D figure plot but I cannot obtain the desired result. The text data should remain at its position even when the 3D model is rotated. I also want the text to extend over several lines.
In an interactive mode I can use the GUI Insert->Text tool, creating a
"hidden" annotation layer with the desired result. However, the hidden annotation layer is not accessible (or created) for a new figure that is created by a MATLAB file.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Jan 2010
This feature has been added in MATLAB 7.0 (R14). If you are using a previous version, read the following:
In MATLAB 6.5 (R13) there is no function called ANNOTATION which can be used to create text annotation objects that are specified in normalized figure units and not with respect to the current axis.
The workaround for this issue is to create a hidden overlay axes on where text can reside and not be subject to the motion of the primary visible axes.
fig1=figure;
ax1=axes;
surf(peaks)
set(gca,'CameraUpVector',[0 0 -1],'CameraUpVectorMode','manual') ;
ax2=axes;
set(ax2,'visible','off');
txt=text;
set(txt,'position',[0,1],'string',{'This is the 1 line','This is the 2 line'});
axes(ax1)
To apply multiple lines of text to one text object, set the text object string to a cell array, where each element in the cell array is a string containing a line of text.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!