AddReorderButtons
No License
AddReorderButtons adds two buttons to the top toolbar of a specified figure. When clicked while a plot object is selected, they will move that object "forward" or "backward" in the rendering list. This is most practically useful for multiple 2D plots in the same axes, in which one plot may partially or completely obscure another; this is a simple way of moving the obscured plot forward without having to change the code that generated the figure.
I personally find this function most useful as part of my DefaultFigureCreateFcn callback, so that all new figures include the buttons. An example of how to do this is included in the download.
Written in R2007b, but should work for the most recent versions of MATLAB.
Example usage:
Enter the following commands at the MATLAB prompt:
>> figure
>> fv.vertices = [-1 0; 0 1; 1 0; 0 -1];
>> fv.faces = [1 2 3 4];
>> fv.facevertexcdata = [0 1 0];
>> patch(fv,'FaceColor','flat')
>> fv.vertices = [-1 -1;-1 1;1 1;1 -1]./sqrt(2);
>> fv.facevertexcdata = [1 0 0];
>> AddReorderButtons
You should have a plot with two overlapping squares, one red and one green. Select the "Edit Plot" tool, and click on the square on top. Press the "Move Current Plot Object Backward" tool to see the reorder buttons in action.
Cite As
Geoffrey Adams (2024). AddReorderButtons (https://www.mathworks.com/matlabcentral/fileexchange/18136-addreorderbuttons), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > App Building > Migrate GUIDE Apps >
- MATLAB > Graphics > Formatting and Annotation > Labels and Annotations > Annotations >
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > Image Arithmetic >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 | Added example usage to description. |