File Exchange

image thumbnail


version (6.59 KB) by Brett Shoelson
Click any axes to expand it in a separate figure. Right-click expanded axes to export contents!


Updated 01 Sep 2016

View License

Allows you to click on any axes (or child thereof) in the list of input handles. Left-clicking will popup a new window in the position of the original, filled with the single axes and all its children. Clicking on that figure closes the popup window. (Right-clicking restores non-expanding status to the axis.)
Sets the current axes to expand on buttondown.

Sets all axes in the input list of handles to expand on buttondown.
NOTE: This function modifies the BUTTONDOWNFCN of axes in the input list, and their children. However, it will not modify any object whose buttondownfcn is nonempty.

In real estate, there's a saying: "Location, location, location." In computer graphics, the saying is (or ought to be): "Real estate, real estate, real estate." This function allows you to show a lot more plots, graphics, etc. in a single figure without sacrificing the ability to see larger versions of same.

Cite As

Brett Shoelson (2020). expandAxes(hndls,rotEnable) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (16)

Brett Shoelson

@Lea: I'm sorry...not sure what you mean. If you downloaded and extracted the zip file and MATLAB can't find it, you need to either move it onto the MATLAB existing path or add the file's location to the current MATLAB path (> doc pathtool, >> doc path).

Lea Corbova

I can not find it in apps, can not add it to Matlab. What should I do?


Useful when you have a lot of plots to compare

Matteo Niccoli

Shawn Heide

This function works perfectly and was really easy to implement. I'm not sure if anyone else has this problem, but I save figures with expandable axes and I've noticed that the oldfig property doesn't always match what the new figure handle is. I added the following code to the nested function expandIt and everything works great. Thanks Brett!

if ~ishandle(hndlSet.oldfig) | hndlSet.oldfig ~= get(, 'Parent')
hndlSet.oldfig = gcf;

Shawn Heide


Brett Shoelson

NOTE: Maryam also asked me if she could modify the tick marks on the pop-up axis. That, too, is easily done. Just make whatever changes you want to customize new_ax at the appropriate place in the code. For instance:

'position',[0.1 0.1 0.8 0.8],...


Brett Shoelson

Maryam, it's very easy to make expandAxes do what you want. Just modify the single line in subfunction "exapandIt" where I create the figure. Change 'menubar','none' to 'menubar','figure'. Let me know if that works for you.

Maryam Vareth

This function is very useful. Thank you!! I was just wondering whether there is an easy way to also add an option to have a full functioning popup plots (meaning, to click into one of the interesting thumbnail images and be able to look at the values, intensities, (things that we can do in regular plot window)? ...

Brett Shoelson

Thanks, Adi. For users of older versions of MATLAB, please note the single quotes around 'isempty' in Adi's comments.


Great gizmo.
Justa little remark. For those still using old Matlab 7.0 R14 I found that " @isempty " needs to be changes to " 'isempty' " in order to work. Good job, thanks.

Sergey Karpov

Thank u!

John D'Errico

A creative way to turn a whole mess of plots into thumbnail images. Then you can click on only the ones you want to see to bring them up.

Bob Rooney

Perfect! Thanks alot.

Olivier B.

Simple but very usefull when managing lot of subplots !


Updated license

Bug fix: should work in old and new versions of MATLAB. (If you have a version of expandAxes that is working for you, no need to change. But if you're encountering errors, this should address them.)

Fixed a couple very minor bugs. Ensured R14b readiness. General cleanup.

Right click on any expanded axes to automatically save contents to base workspace!

Now supports automatic export of images by right-clicking an expanded axes! (If the axes contains a non-image, a snapshot of the axes is exported, using |getframe|.)

Updated M file and license text file copyright to The MathWorks, Inc.

updated license text file to The MathWorks, Inc.

added copyright

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux