
Examples: Programming GUI Components
8-29
Plotting to a GUI with Multiple Axes
If a GUI has multiple axes, explicitly specify which axes you want to target
before you issue a plotting command. You can make the axes you want to target
the current axes by using the
axes function. In the following command, axes1
is the
Tag property of the target axes.
axes(handles.axes1)
The following example contains two axes and two buttons. Clicking one button
generates a plot in one axes and clicking the other button generates a plot in
the other axes. The following figure shows these components as they might
appear in the Layout Editor.
1 Add this code to the Plot 1 push button’s Callback callback. The surf
function produces a 3-D shaded surface plot.
peaks is a function of two
variables, obtained by translating and scaling Gaussian distributions.
axes(handles.axes1)
surf(peaks(35));
Kommentare zu diesen Handbüchern