comparison scripts/plot/plotmatrix.m @ 10549:95c3e38098bf

Untabify .m scripts
author Rik <code@nomad.inbox5.com>
date Fri, 23 Apr 2010 11:28:50 -0700
parents 16f53d29049f
children be55736a0783
comparison
equal deleted inserted replaced
10548:479536c5bb10 10549:95c3e38098bf
72 unwind_protect 72 unwind_protect
73 axes (bigax2); 73 axes (bigax2);
74 newplot (); 74 newplot ();
75 [h2, ax2, p2, pax2, need_usage] = __plotmatrix__ (bigax2, varargin{:}); 75 [h2, ax2, p2, pax2, need_usage] = __plotmatrix__ (bigax2, varargin{:});
76 if (need_usage) 76 if (need_usage)
77 print_usage (); 77 print_usage ();
78 endif 78 endif
79 if (nargout > 0) 79 if (nargout > 0)
80 h = h2; 80 h = h2;
81 ax = ax2; 81 ax = ax2;
82 bigax = bigax2; 82 bigax = bigax2;
83 p = p2; 83 p = p2;
84 pax = pax2; 84 pax = pax2;
85 endif 85 endif
86 axes (bigax2); 86 axes (bigax2);
87 ctext = text (0, 0, "", "visible", "off", 87 ctext = text (0, 0, "", "visible", "off",
88 "handlevisibility", "off", "xliminclude", "off", 88 "handlevisibility", "off", "xliminclude", "off",
89 "yliminclude", "off", "zliminclude", "off", 89 "yliminclude", "off", "zliminclude", "off",
90 "deletefcn", {@plotmatrixdelete, [ax2; pax2]}); 90 "deletefcn", {@plotmatrixdelete, [ax2; pax2]});
91 set (bigax2, "visible", "off"); 91 set (bigax2, "visible", "off");
92 unwind_protect_cleanup 92 unwind_protect_cleanup
93 axes (oldh); 93 axes (oldh);
94 end_unwind_protect 94 end_unwind_protect
95 endif 95 endif
100 100
101 function plotmatrixdelete (h, d, ax) 101 function plotmatrixdelete (h, d, ax)
102 for i = 1 : numel (ax) 102 for i = 1 : numel (ax)
103 hc = ax(i); 103 hc = ax(i);
104 if (ishandle (hc) && strcmp (get (hc, "type"), "axes") && 104 if (ishandle (hc) && strcmp (get (hc, "type"), "axes") &&
105 strcmpi (get (hc, "beingdeleted"), "off")) 105 strcmpi (get (hc, "beingdeleted"), "off"))
106 parent = get (hc, "parent"); 106 parent = get (hc, "parent");
107 ## If the parent is invalid or being deleted, then do nothing 107 ## If the parent is invalid or being deleted, then do nothing
108 if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off")) 108 if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off"))
109 delete (hc); 109 delete (hc);
110 endif 110 endif
111 endif 111 endif
112 endfor 112 endfor
113 endfunction 113 endfunction
114 114
120 for i = 1 : nargin - 1 120 for i = 1 : nargin - 1
121 arg = varargin{i}; 121 arg = varargin{i};
122 if (ischar (arg) || iscell (arg)) 122 if (ischar (arg) || iscell (arg))
123 [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false); 123 [linespec, valid] = __pltopt__ ("plotmatrix", varargin{i}, false);
124 if (valid) 124 if (valid)
125 have_line_spec = true; 125 have_line_spec = true;
126 linespec = varargin(i); 126 linespec = varargin(i);
127 varargin(i) = []; 127 varargin(i) = [];
128 nargin = nargin - 1; 128 nargin = nargin - 1;
129 break; 129 break;
130 else 130 else
131 need_usage = true; 131 need_usage = true;
132 returm; 132 returm;
133 endif 133 endif
134 endif 134 endif
135 endfor 135 endfor
136 136
137 if (nargin == 2) 137 if (nargin == 2)
167 167
168 for i = 1 : n 168 for i = 1 : n
169 for j = 1 : m 169 for j = 1 : m
170 pos = [xsize * (j - 1) + xoff, ysize * (n - i) + yoff, xsize, ysize]; 170 pos = [xsize * (j - 1) + xoff, ysize * (n - i) + yoff, xsize, ysize];
171 tmp = axes ("outerposition", pos, "position", pos + border, 171 tmp = axes ("outerposition", pos, "position", pos + border,
172 "parent", parent); 172 "parent", parent);
173 if (i == j && have_hist) 173 if (i == j && have_hist)
174 pax = [pax ; tmp]; 174 pax = [pax ; tmp];
175 [nn, xx] = hist (X(:, i)); 175 [nn, xx] = hist (X(:, i));
176 tmp = bar (xx, nn, 1.0); 176 tmp = bar (xx, nn, 1.0);
177 p = [p; tmp]; 177 p = [p; tmp];
178 else 178 else
179 ax = [ax ; tmp]; 179 ax = [ax ; tmp];
180 if (have_line_spec) 180 if (have_line_spec)
181 tmp = plot (X (:, i), Y (:, j), linespec); 181 tmp = plot (X (:, i), Y (:, j), linespec);
182 else 182 else
183 tmp = plot (X (:, i), Y (:, j), "."); 183 tmp = plot (X (:, i), Y (:, j), ".");
184 endif 184 endif
185 h = [h ; tmp]; 185 h = [h ; tmp];
186 endif 186 endif
187 endfor 187 endfor
188 endfor 188 endfor
189 endfunction 189 endfunction