No BSD License  

Highlights from
Subaxis - Subplot

4.88235

4.9 | 17 ratings Rate this file 164 Downloads (last 30 days) File Size: 3 KB File ID: #3696

Subaxis - Subplot

by Aslak Grinsted

 

08 Jul 2003 (Updated 10 Jul 2003)

Use HTML jargon for multi axis layout.

| Watch this File

File Information
Description

SUBAXIS Create axes in tiled positions. (just like subplot)
    Usage:
       h=subaxis(rows,cols,cellno[,settings])
       h=subaxis(rows,cols,cellx,celly[,settings])
       h=subaxis(rows,cols,cellx,celly,spanx,spany[,settings])
 
  SETTINGS: Spacing,SpacingHoriz,SpacingVert
            Padding,PaddingRight,PaddingLeft,PaddingTop,PaddingBottom
            Margin,MarginRight,MarginLeft,MarginTop,MarginBottom
            Holdaxis
 
            all units are relative (e.g from 0 to 1)
 
            Abbreviations of parameters can be used.. (Eg MR instead of MarginRight)
            (holdaxis means that it wont delete any axes below.)
 
 
  Example:
 
    >> subaxis(2,1,1,'SpacingVert',0,'MR',0);
    >> imagesc(magic(3))
    >> subaxis(2,'p',.02);
    >> imagesc(magic(4))
 
  2001 / Aslak Grinsted (Feel free to modify this code.)

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (17)
28 Apr 2004 Stephan Zeipel

Works great!
Thanks

29 Apr 2005 Janik Zikovsky

A worthy replacement to subplot, which is not nearly flexible enough. Being able to span cells is great!

30 Aug 2005 Marcello Vichi

Great Matlab programming. I'm not using subplot anymore...
I also enjoyed parseArgs, which is very useful to include in my own mfiles.

09 Jan 2006 antoine stephany

good job !

29 Jul 2007 jon erickson

Awesome--far superior to subplot. This function is a slightly tricky to use at first, but a few minutes of practice/playing around and you'll never go back to subplot.
mathworks should make this standard...

30 Jan 2008 Stine Gro Jensen

This is just what I needed! Great! I fully agree with the other reviewers. Take your time to work it out, and you will never use subplot again.

22 Feb 2008 Eduardo Gonzalez

Just great. I don't use subplot any more. Useful not just for subplots but to eliminate the blank space around the graphic in one plot.

28 Jul 2008 Andrzej Lewarek

Just great. It was exactly what I was looking for. Thanks!

07 Nov 2009 Raymond Cheng

Thanks for your sharing.

17 Dec 2009 Jeff Robble  
10 Nov 2010 Pearl  
07 Apr 2011 Dan Knudsen  
29 Apr 2011 Oscar

Very useful, thanks

15 Jul 2011 AMVR

Great work! It works great in general, although I'm having problems using subaxis to display images in their original aspect ratio. Let me explain, when displaying an image on a figure, I like asking the figure to display the image preserving the natural aspect ratio of the image.

I usually accomplish this by calling imshow, e.g.:

figure;
imshow(I, []);

Now, if I try to do this with subaxis (asking it to use 0 padding, 0 padding and 0 spacing):

--------------------
figure;
I = imread('pout.tif');

subaxis(1,2, 1, 'sh',0,'sv',0,'MR',0, 'ML', 0, 'MT', 0, 'MB', 0, 'PaddingTop', 0, 'PaddingBottom', 0, 'PaddingLeft', 0, 'PaddingRight', 0);

imshow(I', []);

subaxis(1,2, 1, 'sh',0,'sv',0,'MR',0, 'ML', 0, 'MT', 0, 'MB', 0, 'PaddingTop', 0, 'PaddingBottom', 0, 'PaddingLeft', 0, 'PaddingRight', 0);

imshow(I', []);
--------------------

You'll see that the figure displays the images correctly (i.e. it preserves their aspect ratio), BUT there is white space around the images within the figure, even though I explicitly asked subaxis to remove whitespace in the figure.

Any thoughts?

Other that, it works like a charm. Thanks!

09 Oct 2011 Keegan

sexiest file exchange program ever.

08 Dec 2011 Dmitry

This saved me much time, and I doubt I'll be going back to subplot.

01 Feb 2012 Toby Hijzen

Very usefull and handy function.
I'm just missing functionality like
subplot(2,2,[1 3])

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
annotation Aslak Grinsted 22 Oct 2008 07:04:26
axis Aslak Grinsted 22 Oct 2008 07:04:27
subplot Aslak Grinsted 22 Oct 2008 07:04:27
customization Aslak Grinsted 22 Oct 2008 07:04:27
multiplot Aslak Grinsted 22 Oct 2008 07:04:27
graphics Aslak Grinsted 22 Oct 2008 07:04:27
panel Aslak Grinsted 08 Aug 2011 08:51:25
html Aslak Grinsted 08 Aug 2011 08:51:28
margin Aslak Grinsted 08 Aug 2011 08:51:32
spacing Aslak Grinsted 08 Aug 2011 08:51:36
tiled Aslak Grinsted 08 Aug 2011 08:52:07
grid Aslak Grinsted 22 Aug 2011 07:41:58

Contact us at files@mathworks.com