Be the first to rate this file! 12 Downloads (last 30 days) File Size: 4.66 KB File ID: #27713
image thumbnail

MontageFigures

by Nick Sinclair

 

24 May 2010 (Updated 03 Aug 2010)

Creates Montage (subplots) of Specified Figures and their subplots

| Watch this File

File Information
Description

This creates a new figure containing subplots of other currently open figures including all non-colorbar axes in the figure (i.e. including subplots).

example: i have figures 12 15 18 open. and I want a montage with 12 and 15 on the first line and 18 on the next.

mfig = MontageFigures([12 15 18], 2,2)

where the horizontal length is the first 2
vertical length is the second 2. This will leave the 4th subplot (2,2) empty.

mfig is the handle to the new figure.

This is similar to the code figs2subplots, but after very few attempts, I couldn't get that to work. So here's something that should work. And it's very simple.

You specify the axis properties that you'd like copied over from the old figures at the beginning of the file. I have a prototype set included.

The code simply copies all of the children of each figures' axes and puts them as children of the subplot axes. Then copies the specified properties to the subplot axes.

In the code you can now adjust size/position of new fig, margins, spacing between subplots. You can also set whether to add ticks and labels only to perimeter plots, if you have many images with the same limits/labels.

If you want to do this with unopened files use the montagefigurefiles(columns,rows), and you will be prompted for the files to use.

If you don't like this script, you can try using:
http://www.mathworks.com/matlabcentral/fileexchange/3939-import-fig-file-to-axes
which I didn't bother to look at, but I'm open to it being better. :)

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
09 Jul 2010 Mark Hayworth

A screenshot would be SO helpful.

29 Aug 2010 jhh

It seems to damage my legends. Otherwise works OK.

Please login to add a comment or rating.
Updates
07 Jul 2010

just verified it works fine with 7.10 2010a.

08 Jul 2010

Can now adjust
1) size/position of new figure
2) spacing between subplots
3) margins
4) whether to label only perimeter subplots.
These options must be changed in the code, not as parameters to the code. Just too lazy to add that.

08 Jul 2010

Added montagefigurefies.m AND ability to replot the subplots of other figures.

08 Jul 2010

Fixed problem of copying over legends as separate axes, and added ability to copy legends in an appropriate way.

09 Jul 2010

added screenshot

03 Aug 2010

fixed a typo, referring to incorrect axis for xlabel

Tag Activity for this File
Tag Applied By Date/Time
montage Nick Sinclair 24 May 2010 12:33:13
subplot Nick Sinclair 24 May 2010 12:33:13
copy Nick Sinclair 24 May 2010 12:33:13
plot Nick Sinclair 24 May 2010 12:33:13
figure Nick Sinclair 24 May 2010 12:33:13
copyobj Nick Sinclair 24 May 2010 12:33:13
axes Nick Sinclair 24 May 2010 12:33:13
image Nick Sinclair 24 May 2010 12:33:13
gui Nick Sinclair 08 Jul 2010 10:58:24
data import Nick Sinclair 08 Jul 2010 10:58:24
data export Nick Sinclair 08 Jul 2010 10:58:24
import Nick Sinclair 09 Jul 2010 12:00:29
figure Varun 24 Jul 2010 12:56:24
axes Jose Ercolino 29 Mar 2011 16:30:48
copy Jose Ercolino 29 Mar 2011 16:30:49
copyobj Jose Ercolino 29 Mar 2011 16:30:54
montage Jose Ercolino 29 Mar 2011 16:31:03
plot Jose Ercolino 29 Mar 2011 16:31:06
paste Jose Ercolino 29 Mar 2011 16:31:18

Contact us at files@mathworks.com