File Exchange

image thumbnail

copyUIAxes

version 4.0.1 (193 KB) by Adam Danz
Copy UIAxes (eg. AppDesigner) and most properties to a new figure and recreate the legend and colorbar if they exist.

1.1K Downloads

Updated 17 Mar 2021

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Use copyUIAxes() to copy plots in AppDesigner or any UIAxes onto regular axes which can be easily saved, printed, or modified.

copyUIAxes copies all children and most properties of a UIAxes to regular axes. If the UIAxes has a legend or colorbar, they can be recreated in the new axes, too.

copyUIAxes(ax) creates a new figure and copies the UIAxes (ax) content to the new figure.

copyUIAxes(ax, destination) copies the UIAxes to the destination which can be a figure or axis handle.

copyUIAxes(ax, 'copyPosition', true) will copy the position properties so the copied axes have the same position relative to the figure as the UIAxes or App.

See the file's help section and the demo document for other optional inputs and demos.

--------------------------------Notes--------------------------------
In r2020a Matlab released exportgraphics() and copygraphics() which can be used to copy uiaxes and uifigures which makes parts of copyUIAxes() obsolete.

For discussion on this topic:
https://www.mathworks.com/matlabcentral/answers/281318-how-can-i-save-a-figure-within-app-designer

Cite As

Adam Danz (2021). copyUIAxes (https://www.mathworks.com/matlabcentral/fileexchange/73103-copyuiaxes), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with R2016a to R2020b
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: export_fig

Inspired: BoxPlotPro, Phase Portrait Plotter

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!