reference
labkit.app.plot.clearAxes
Prepare an axes for an app-owned redraw.
Syntax
labkit.app.plot.clearAxes(ax)
labkit.app.plot.clearAxes(ax, Name=Value)Inputs
ax- Valid scalar MATLAB axes or uiaxes handle to clear.
Name-Value Arguments
ResetScale- Logical value. true restores linear X/Y scales and automatic X/Y tick modes. false preserves those four properties. Default: false.
ClearLegend- Logical value. true turns the legend off. Default: true.
Outputs
None.
Description
clear deletes plotted children, clears LabKit's cached image home view, releases hold, and returns XLim, YLim, ZLim, and CLim to automatic mode. Labels and other axes decorations follow MATLAB cla behavior. Call it once at the start of a complete redraw, not when adding an overlay that should preserve the current zoom.
Errors
labkit:app:plot:InvalidAxes- ax is not a valid scalar axes handle. labkit:app:plot:InvalidOptions or labkit:app:plot:InvalidOption - Name-value arguments are malformed or unsupported. MATLAB graphics errors raised while clearing a valid axes propagate to the caller.
Example
fig = figure("Visible", "off");
cleanup = onCleanup(@() close(fig));
ax = axes(fig);
plot(ax, 1:3, [2 1 3]);
labkit.app.plot.clearAxes(ax, "ResetScale", true);
assert(isempty(ax.Children))Related APIs
labkit.app.plot.fitAxesToGraphics— Fit axes limits to finite plotted X/Y data.labkit.app.plot.showMessage— Show a centered empty-state message in an axes.labkit.app.plot.clampPointToAxes— Keep data coordinates inside the visible axes box.labkit.app.plot.enablePopout— Add a standalone-figure action to an axes context menu.labkit.app.plot.fitCanvasToSource— Fit a preview axes into a fixed-aspect pixel frame.labkit.app.plot.offsetPointByAxesFraction— Move data coordinates by normalized axes fractions.
Source
This page is generated from the MATLAB help text in +labkit/+app/+plot/clearAxes.m.