Is it possible to draw a plot in a frame uicontrol in MATLAB?

3 views (last 30 days)
I would like to draw a plot in a frame uicontrol in MATLAB. How can this be done using MATLAB 7.0 (R14)?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
It is not possible to draw a plot on top of a frame uicontrol in MATLAB. However, it is possible to place axes objects on top of UIPANEL objects (which were introduced in MATLAB 7.0 (R14)).
It is not possible to display an axes on top of a frame uicontrol because the uicontrols are placed over the figure window rather than within the figure window. Therefore, the frame uicontrol will always be drawn on top of the axes.
If you are using a version of MATLAB prior to 7.0, or if you want to use a frame uicontrol with MATLAB 7.0 instead of a uipanel, you may want to create a second axes and set its color so that it is similar to the frame color.
For example:
figure;
h_frame = uicontrol('style','frame');
frame_color = get(h_frame,'BackGroundColor');
delete(h_frame)
ax_frame = axes('color',frame_color,'ytick',[],'xtick',[]);
box on;
ax_plot = axes('position',[.2 .2 .5 .6])
plot(1:10)

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!