comparison scripts/plot/private/__patch__.m @ 14868:5d3a684236b0

maint: Use Octave coding conventions for cuddling parentheses in scripts directory * lin2mu.m, loadaudio.m, wavread.m, accumarray.m, bicubic.m, celldisp.m, colon.m, cplxpair.m, dblquad.m, divergence.m, genvarname.m, gradient.m, int2str.m, interp1.m, interp1q.m, interp2.m, interpn.m, loadobj.m, nthargout.m, __isequal__.m, __splinen__.m, quadgk.m, quadl.m, quadv.m, rat.m, rot90.m, rotdim.m, saveobj.m, subsindex.m, triplequad.m, delaunay3.m, griddata.m, inpolygon.m, tsearchn.m, voronoi.m, get_first_help_sentence.m, which.m, gray2ind.m, pink.m, dlmwrite.m, strread.m, textread.m, textscan.m, housh.m, ishermitian.m, issymmetric.m, krylov.m, logm.m, null.m, rref.m, compare_versions.m, copyfile.m, dump_prefs.m, edit.m, fileparts.m, getappdata.m, isappdata.m, movefile.m, orderfields.m, parseparams.m, __xzip__.m, rmappdata.m, setappdata.m, swapbytes.m, unpack.m, ver.m, fminbnd.m, fminunc.m, fsolve.m, glpk.m, lsqnonneg.m, qp.m, sqp.m, configure_make.m, copy_files.m, describe.m, get_description.m, get_forge_pkg.m, install.m, installed_packages.m, is_architecture_dependent.m, load_package_dirs.m, print_package_description.m, rebuild.m, repackage.m, save_order.m, shell.m, allchild.m, ancestor.m, area.m, axes.m, axis.m, clabel.m, close.m, colorbar.m, comet.m, comet3.m, contour.m, cylinder.m, ezmesh.m, ezsurf.m, findobj.m, fplot.m, hist.m, isocolors.m, isonormals.m, isosurface.m, isprop.m, legend.m, mesh.m, meshz.m, pareto.m, pcolor.m, peaks.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, print.m, __add_datasource__.m, __add_default_menu__.m, __axes_limits__.m, __bar__.m, __clabel__.m, __contour__.m, __errcomm__.m, __errplot__.m, __ezplot__.m, __file_filter__.m, __fltk_print__.m, __ghostscript__.m, __gnuplot_print__.m, __go_draw_axes__.m, __go_draw_figure__.m, __interp_cube__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __print_parse_opts__.m, __quiver__.m, __scatter__.m, __stem__.m, __tight_eps_bbox__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiputfile_fltk__.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, scatter.m, semilogy.m, shading.m, slice.m, subplot.m, surface.m, surfl.m, surfnorm.m, text.m, uigetfile.m, uiputfile.m, whitebg.m, deconv.m, mkpp.m, pchip.m, polyaffine.m, polyder.m, polygcd.m, polyout.m, polyval.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, addpref.m, getpref.m, setpref.m, ismember.m, setxor.m, arch_fit.m, arch_rnd.m, arch_test.m, autoreg_matrix.m, diffpara.m, fftconv.m, filter2.m, hanning.m, hurst.m, periodogram.m, triangle_sw.m, sinc.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicgstab.m, gmres.m, pcg.m, pcr.m, __sprand_impl__.m, speye.m, spfun.m, sprandn.m, spstats.m, svds.m, treelayout.m, treeplot.m, bessel.m, factor.m, legendre.m, perms.m, primes.m, magic.m, toeplitz.m, corr.m, cov.m, mean.m, median.m, mode.m, qqplot.m, quantile.m, ranks.m, zscore.m, logistic_regression_likelihood.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, kolmogorov_smirnov_test.m, run_test.m, u_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, bin2dec.m, dec2base.m, mat2str.m, strcat.m, strchr.m, strjust.m, strtok.m, substr.m, untabify.m, assert.m, demo.m, example.m, fail.m, speed.m, test.m, now.m: Use Octave coding conventions for cuddling parentheses in scripts directory.
author Rik <octave@nomad.inbox5.com>
date Tue, 17 Jul 2012 07:08:39 -0700
parents 86854d032a37
children c2dbdeaa25df
comparison
equal deleted inserted replaced
14867:97ce18b62d0f 14868:5d3a684236b0
38 args = {"xdata", [0; 1; 0], "ydata", [1; 1; 0], "facecolor", [0, 0, 0]}; 38 args = {"xdata", [0; 1; 0], "ydata", [1; 1; 0], "facecolor", [0, 0, 0]};
39 args = setvertexdata (args); 39 args = setvertexdata (args);
40 elseif (isstruct (varargin{1})) 40 elseif (isstruct (varargin{1}))
41 if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces")) 41 if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces"))
42 args{1} = "faces"; 42 args{1} = "faces";
43 args{2} = getfield(varargin{1}, "faces"); 43 args{2} = getfield (varargin{1}, "faces");
44 args{3} = "vertices"; 44 args{3} = "vertices";
45 args{4} = getfield(varargin{1}, "vertices"); 45 args{4} = getfield (varargin{1}, "vertices");
46 args{5} = "facevertexcdata"; 46 args{5} = "facevertexcdata";
47 if (isfield (varargin{1}, "facevertexcdata")) 47 if (isfield (varargin{1}, "facevertexcdata"))
48 args{6} = getfield(varargin{1}, "facevertexcdata"); 48 args{6} = getfield (varargin{1}, "facevertexcdata");
49 else 49 else
50 args{6} = []; 50 args{6} = [];
51 endif 51 endif
52 args = [args; varargin(2:end)]; 52 args = [args; varargin(2:end)];
53 args = setdata (args); 53 args = setdata (args);
207 addlistener (h, "vertices", @update_fvc); 207 addlistener (h, "vertices", @update_fvc);
208 addlistener (h, "facevertexcdata", @update_fvc); 208 addlistener (h, "facevertexcdata", @update_fvc);
209 endif 209 endif
210 endfunction 210 endfunction
211 211
212 function args = delfields(args, flds) 212 function args = delfields (args, flds)
213 idx = cellfun (@(x) any (strcmpi (x, flds)), args); 213 idx = cellfun (@(x) any (strcmpi (x, flds)), args);
214 if (rows (idx) == 1) 214 if (rows (idx) == 1)
215 idx = idx | [false, idx(1:end-1)]; 215 idx = idx | [false, idx(1:end-1)];
216 else 216 else
217 idx = idx | [false; idx(1:end-1)]; 217 idx = idx | [false; idx(1:end-1)];
235 vert = []; 235 vert = [];
236 else 236 else
237 vert = args {idx}; 237 vert = args {idx};
238 endif 238 endif
239 idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1; 239 idx = find (strcmpi (args, "facevertexcdata"), 1, "last") + 1;
240 if (isempty(idx) || idx > nargs) 240 if (isempty (idx) || idx > nargs)
241 fvc = []; 241 fvc = [];
242 else 242 else
243 fvc = args {idx}; 243 fvc = args {idx};
244 endif 244 endif
245 idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; 245 idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
246 if (isempty(idx) || idx > nargs) 246 if (isempty (idx) || idx > nargs)
247 if (!isempty (fvc)) 247 if (!isempty (fvc))
248 fc = "flat"; 248 fc = "flat";
249 else 249 else
250 fc = [0, 1, 0]; 250 fc = [0, 1, 0];
251 endif 251 endif
259 first_idx_in_column = find (t1(:,i), 1); 259 first_idx_in_column = find (t1(:,i), 1);
260 idx(first_idx_in_column:end,i) = idx(first_idx_in_column-1,i); 260 idx(first_idx_in_column:end,i) = idx(first_idx_in_column-1,i);
261 endfor 261 endfor
262 x = reshape (vert(:,1)(idx), size (idx)); 262 x = reshape (vert(:,1)(idx), size (idx));
263 y = reshape (vert(:,2)(idx), size (idx)); 263 y = reshape (vert(:,2)(idx), size (idx));
264 if (size(vert,2) > 2) 264 if (columns (vert) > 2)
265 z = reshape (vert(:,3)(idx), size (idx)); 265 z = reshape (vert(:,3)(idx), size (idx));
266 else 266 else
267 z = []; 267 z = [];
268 endif 268 endif
269 269
270 if (size(fvc, 1) == nc || size (fvc, 1) == 1) 270 if (rows (fvc) == nc || rows (fvc) == 1)
271 c = reshape (fvc, [1, size(fvc)]); 271 c = reshape (fvc, [1, size(fvc)]);
272 else 272 else
273 if (size(fvc, 2) == 3) 273 if (columns (fvc) == 3)
274 c = cat(3, reshape (fvc(idx, 1), size(idx)), 274 c = cat (3, reshape (fvc(idx, 1), size (idx)),
275 reshape (fvc(idx, 2), size(idx)), 275 reshape (fvc(idx, 2), size (idx)),
276 reshape (fvc(idx, 3), size(idx))); 276 reshape (fvc(idx, 3), size (idx)));
277 elseif (isempty (fvc)) 277 elseif (isempty (fvc))
278 c = []; 278 c = [];
279 else ## if (size (fvc, 2) == 1) 279 else ## if (size (fvc, 2) == 1)
280 c = permute (fvc(faces), [2, 1]); 280 c = permute (fvc(faces), [2, 1]);
281 endif 281 endif
299 y = []; 299 y = [];
300 else 300 else
301 y = args {idx}; 301 y = args {idx};
302 endif 302 endif
303 idx = find (strcmpi (args, "zdata"), 1, "last") + 1; 303 idx = find (strcmpi (args, "zdata"), 1, "last") + 1;
304 if (isempty(idx) || idx > nargs) 304 if (isempty (idx) || idx > nargs)
305 z = []; 305 z = [];
306 else 306 else
307 z = args {idx}; 307 z = args {idx};
308 endif 308 endif
309 idx = find (strcmpi (args, "cdata"), 1, "last") + 1; 309 idx = find (strcmpi (args, "cdata"), 1, "last") + 1;
310 if (isempty(idx) || idx > nargs) 310 if (isempty (idx) || idx > nargs)
311 c = []; 311 c = [];
312 else 312 else
313 c = args {idx}; 313 c = args {idx};
314 endif 314 endif
315 idx = find (strcmpi (args, "facecolor"), 1, "last") + 1; 315 idx = find (strcmpi (args, "facecolor"), 1, "last") + 1;
316 if (isempty(idx) || idx > nargs) 316 if (isempty (idx) || idx > nargs)
317 if (!isempty (c)) 317 if (!isempty (c))
318 fc = "flat"; 318 fc = "flat";
319 else 319 else
320 fc = [0, 1, 0]; 320 fc = [0, 1, 0];
321 endif 321 endif
330 if (!isempty (z)) 330 if (!isempty (z))
331 vert = [x(:), y(:), z(:)]; 331 vert = [x(:), y(:), z(:)];
332 else 332 else
333 vert = [x(:), y(:)]; 333 vert = [x(:), y(:)];
334 endif 334 endif
335 faces = reshape (1:numel(x), nr, nc); 335 faces = reshape (1:numel (x), nr, nc);
336 faces = faces'; 336 faces = faces';
337 337
338 if (ndims (c) == 3) 338 if (ndims (c) == 3)
339 fvc = reshape (c, size (c, 1) * size (c, 2), size(c, 3)); 339 fvc = reshape (c, size (c, 1) * size (c, 2), size (c, 3));
340 else 340 else
341 fvc = c(:); 341 fvc = c(:);
342 endif 342 endif
343 343
344 args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}}; 344 args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}};