User`s guide
Examples: Program GUI C omponents
See “GUI with Multiple Axes (GUIDE)” on page 10-2 for a more complex
example that uses two axes.
If your GUI contains axes, you should ensure that their
HandleVisibility
properties are set to callback. This a llows callbacks to change the contents
of the axes and prevents command line operations from doing so. The default
is
on.
When drawing anything into axes, a GUI’s code should specify the handle of
theaxestouse. Donotcounton
gca for this purpose, as it can create a figure
if the current figure or intended axes has its
HandleVisibility property not
set to
'on'. See “Specifying the Target for Graphics Output” for details.
Tip When working with multiple axes, it is best not to “raise” the axes y ou
want to plot data into with commands like
axes(a1)
This will make axes a1 the current axes, but it also restacks figures and
flushes all pending events, which consumes computer resources and is rarely
necessary for a callback to do. It is more efficient to simply supply the axes
handle as the first argument of the plotting function you are calling, such as
plot(a1, ...)
which outputs the graphics to axes a1 without restacking figures or flushing
queued events. To designate an axes for plotting functions which do not
accept and axes handle argument, such as the
line function, you can make a1
the current axes as follows.
set(figure_handle,'CurrentAxes',a1)
line(x,y,z,...)
See the Curr entAxes description in the figure properties refere nce page for
more details.
For more information about:
12-33