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.
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.
|Charting and Animation|
|Retrieving and Saving Data|
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.
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,
gca is the
gca cannot return UI
figures and UI axes, so omitting them might lead to unexpected results.
plot(app.UIAxes,[1 2 3 4],'-r'); hold(app.UIAxes); plot(app.UIAxes,[10 9 4 7],'--b');
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
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); surf(ax,peaks) colormap(ax,'winter') colorbar(ax)