You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
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 (2026). AddReorderButtons (https://www.mathworks.com/matlabcentral/fileexchange/18136-addreorderbuttons), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.0.0.0 (1.86 KB)
-
No License
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 | Added example usage to description. |
