annotate aim-mat/tools/mysubplot.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % tool
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
bleeck@3 7 % This external file is included as part of the 'aim-mat' distribution package
bleeck@3 8 % (c) 2011, University of Southampton
bleeck@3 9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 10 % download of current version is on the soundsoftware site:
bleeck@3 11 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 12 % documentation and everything is on http://www.acousticscale.org
bleeck@3 13
tomwalters@0 14
tomwalters@0 15 function back=mysubplot(nr_y,nr_x,nr,rect, hint)
tomwalters@0 16 % usage: mysubplot(nr_y,nr_x,nr,rect, hint))
tomwalters@0 17 % exact like subplot, but can draw into arbitrary figures
tomwalters@0 18 % the rect in which the new axis are plottet are given by rect.
tomwalters@0 19 % if rect is not given, 0 0 1 1 is taken
tomwalters@0 20 % rect is (x_min,y_min,x_width,y_width)
tomwalters@0 21 % hint gives additionally information about spaces in the graphic
tomwalters@0 22 % hint=0: normal with spaces everywere (every figure has its own axis)
tomwalters@0 23 % hint=1: Space only at the bottom and on the left. of the outer pictures. There are the titles
tomwalters@0 24
tomwalters@0 25 spacing=0.05;
tomwalters@0 26
tomwalters@0 27 if nargin < 4
tomwalters@0 28 rect=[0 0 1 1];
tomwalters@0 29 end
tomwalters@0 30
tomwalters@0 31 if nargin < 5
tomwalters@0 32 hint=0;
tomwalters@0 33 end
tomwalters@0 34
tomwalters@0 35 rectleft=rect(1);
tomwalters@0 36 rectbottom=rect(2);
tomwalters@0 37 rectwidth=rect(3);
tomwalters@0 38 rectheight=rect(4);
tomwalters@0 39
tomwalters@0 40
tomwalters@0 41 if hint==0
tomwalters@0 42 distleft=rectwidth*spacing; % der Abstand, der vom Rand eingehalten werden soll
tomwalters@0 43 distright=rectwidth*spacing;
tomwalters@0 44 disthochzwischen=rectheight*spacing; % Abstand zwischen zwei vertikalen Bildern
tomwalters@0 45 distbreitzwischen=rectwidth*spacing; % Abstand zwischen zwei vertikalen Bildern
tomwalters@0 46 distunten=rectwidth*spacing; % Abstand nach unten
tomwalters@0 47 end
tomwalters@0 48 if hint==1
tomwalters@0 49 distleft=rectwidth*spacing; % der Abstand, der vom Rand eingehalten werden soll
tomwalters@0 50 distright=0;
tomwalters@0 51 disthochzwischen=rectheight*0.01; % Abstand zwischen zwei vertikalen Bildern
tomwalters@0 52 distbreitzwischen=0; % Abstand zwischen zwei vertikalen Bildern
tomwalters@0 53 distunten=rectwidth*spacing; % Abstand nach unten
tomwalters@0 54 end
tomwalters@0 55
tomwalters@0 56 if hint==0
tomwalters@0 57 x=rectwidth/nr_x;
tomwalters@0 58 y=rectheight/nr_y;
tomwalters@0 59
tomwalters@0 60 nnx=mod(nr-1,nr_x);
tomwalters@0 61 ges=nr_x*nr_y;
tomwalters@0 62 nny=ges/nr_x - round((nr-1)/nr_x+0.5);
tomwalters@0 63
tomwalters@0 64 left=distleft+x*nnx;
tomwalters@0 65 bottom=distunten+y*nny;
tomwalters@0 66 width=x-distleft-distright;
tomwalters@0 67 height=y-distunten-disthochzwischen;
tomwalters@0 68 end
tomwalters@0 69 if hint==1
tomwalters@0 70 x=(rectwidth-distleft)/nr_x;
tomwalters@0 71 y=(rectheight-distunten)/nr_y;
tomwalters@0 72
tomwalters@0 73 nnx=mod(nr-1,nr_x);
tomwalters@0 74 ges=nr_x*nr_y;
tomwalters@0 75 nny=ges/nr_x - round((nr-1)/nr_x+0.5);
tomwalters@0 76
tomwalters@0 77 left=distleft+x*nnx;
tomwalters@0 78 bottom=distunten+y*nny;
tomwalters@0 79 width=x-distbreitzwischen;
tomwalters@0 80 height=y-disthochzwischen;
tomwalters@0 81 end
tomwalters@0 82
tomwalters@0 83 back=[rectleft+left rectbottom+bottom width height];
tomwalters@0 84
tomwalters@0 85 axes('position',back);