Creating Graphical User Interfaces |
Axes enable your GUI to display graphics (e.g., graphs and images). Like all graphics objects, axes have properties that you can set to control many aspects of its behavior and appearance. See Axes Properties" in the MATLAB Graphics documentation for general information on axes objects.
Axes Callbacks
Axes are not uicontrol objects, but can be programmed to execute a callback when users click a mouse button in the axes. Use the axes ButtonDownFcn
property to define the callback.
Plotting to Axes in GUIs
GUIs that contain axes should ensure the Command-line accessibility option in the GUI Options dialog is set to Callback (the default). This enables you to issue plotting commands from callbacks without explicitly specifying the target axes. See Command-Line Accessibility for more information about how this option works.
Note If your GUI is opened as the result of another GUI's callback, you might need to explicitly specify the target axes. See GUIs with Multiple Axes following. |
GUIs with Multiple Axes
If a GUI has multiple axes, you should explicitly specify which axes you want to target when you issue plotting commands. You can do this using the axes
command and the handles
structure. For example,
makes the axes whose Tag
property is axes1
the current axes, and therefore the target for plotting commands. You can switch the current axes whenever you want to target a different axes. See GUI with Multiple Axes for an example that uses two axes.
Enabling or Disabling Controls | Figure |