This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Graphics Support in App Designer

The types of charts your app can support depend largely on the kind of figure that underlies the UI. Apps you create using GUIDE and apps you create programmatically using the uicontrol function use traditional figures and axes. These apps support all the graphics functionality available in MATLAB®.

Apps you create using App Designer are based on a new kind of figure, called a UI figure. To display graphics in these apps, you must use a new type of axes, called UI axes.

UI figures and UI axes are similar to traditional figures and axes, but there are some important differences to be aware of when deciding how to build your app.

Graphics Limitations

As of R2017b, UI figures and UI axes support most graphics functionality in MATLAB, but not all. This table lists the set of unsupported functionality that is relevant to most app building workflows.

CategoryNot Supported
Charting and Animation
Retrieving and Saving Data
Interactive functionality
  • For example, print, ginput, gtext, as well as mouse and keyboard callbacks for figures and axes


axes, polaraxes, uicontrol, uitoolbar, and uicontextmenu are not supported. However, UI figures support a new set of components, including tabs, trees, switches, and gauges. For a full list of supported components, see Designing Apps in App Designer.


Some component properties are not supported in UI figures. For a list of supported properties for a particular component, see its property page on Designing Apps in App Designer.


See Graphics Support in App Designer (R2016a - R2017a) for a list of graphics functions supported in earlier releases.

How to Call Graphics Functions

In general, when you call a function within App Designer that accepts a target axes or figure, you must specify that argument as the UI axes or UI figure. Otherwise, MATLAB assumes gcf or gca is the target. However, gcf and gca cannot return UI figures and UI axes, so omitting them might lead to unexpected results.

This code shows how to plot two lines in App Designer. The first argument passed to plot and hold is app.UIAxes, which is the default name that App Designer assigns to the UI axes.

plot(app.UIAxes,[1 2 3 4],'-r');
plot(app.UIAxes,[10 9 4 7],'--b');

Some functions (such as imshow and triplot) require a name-value pair argument to specify the target. For example, this code shows how to call the imshow function in App Designer.


Determine Whether Your Graphics Workflow is Supported

Most MATLAB functions are supported, and many MATLAB toolbox functions that accept an axes target are also supported. You can determine whether App Designer supports a specific workflow by testing your code at the command line using the uifigure and uiaxes functions. Use syntaxes that accept a figure or axes as the target. For example, the following code plots a surface using the winter colormap and displays a colorbar.

f = uifigure;
ax = uiaxes(f);

See Also


Related Topics

Was this topic helpful?