comparison scripts/plot/private/__plt__.m @ 10549:95c3e38098bf

Untabify .m scripts
author Rik <code@nomad.inbox5.com>
date Fri, 23 Apr 2010 11:28:50 -0700
parents 4516a0c97ced
children ca6d8a38d298
comparison
equal deleted inserted replaced
10548:479536c5bb10 10549:95c3e38098bf
42 retval = []; 42 retval = [];
43 43
44 while (nargs > 0 || x_set) 44 while (nargs > 0 || x_set)
45 45
46 if (nargs == 0) 46 if (nargs == 0)
47 ## Force the last plot when input variables run out. 47 ## Force the last plot when input variables run out.
48 next_cell = {}; 48 next_cell = {};
49 next_arg = {""}; 49 next_arg = {""};
50 else 50 else
51 next_cell = varargin(k); 51 next_cell = varargin(k);
52 next_arg = varargin{k++}; 52 next_arg = varargin{k++};
53 endif 53 endif
54 54
55 nargs--; 55 nargs--;
56 56
57 if (ischar (next_arg) || iscellstr (next_arg)) 57 if (ischar (next_arg) || iscellstr (next_arg))
58 if (x_set) 58 if (x_set)
59 [options, valid] = __pltopt__ (caller, next_arg, false); 59 [options, valid] = __pltopt__ (caller, next_arg, false);
60 if (! valid) 60 if (! valid)
61 if (nargs == 0) 61 if (nargs == 0)
62 error ("%s: properties must appear followed by a value", caller); 62 error ("%s: properties must appear followed by a value", caller);
63 endif 63 endif
64 properties = [properties, [next_cell, varargin(k++)]]; 64 properties = [properties, [next_cell, varargin(k++)]];
65 nargs--; 65 nargs--;
66 continue; 66 continue;
67 else 67 else
68 while (nargs > 0 && ischar (varargin{k})) 68 while (nargs > 0 && ischar (varargin{k}))
69 if (nargs < 2) 69 if (nargs < 2)
70 error ("%s: properties must appear followed by a value", 70 error ("%s: properties must appear followed by a value",
71 caller); 71 caller);
72 endif 72 endif
73 properties = [properties, varargin(k:k+1)]; 73 properties = [properties, varargin(k:k+1)];
74 k += 2; 74 k += 2;
75 nargs -= 2; 75 nargs -= 2;
76 endwhile 76 endwhile
77 endif 77 endif
78 if (y_set) 78 if (y_set)
79 tmp = __plt2__ (h, x, y, options, properties); 79 tmp = __plt2__ (h, x, y, options, properties);
80 properties = {}; 80 properties = {};
81 retval = [retval; tmp]; 81 retval = [retval; tmp];
82 else 82 else
83 tmp = __plt1__ (h, x, options, properties); 83 tmp = __plt1__ (h, x, options, properties);
84 properties = {}; 84 properties = {};
85 retval = [retval; tmp]; 85 retval = [retval; tmp];
86 endif 86 endif
87 x_set = false; 87 x_set = false;
88 y_set = false; 88 y_set = false;
89 else 89 else
90 error ("plot: no data to plot"); 90 error ("plot: no data to plot");
91 endif 91 endif
92 elseif (x_set) 92 elseif (x_set)
93 if (y_set) 93 if (y_set)
94 options = __pltopt__ (caller, {""}); 94 options = __pltopt__ (caller, {""});
95 tmp = __plt2__ (h, x, y, options, properties); 95 tmp = __plt2__ (h, x, y, options, properties);
96 retval = [retval; tmp]; 96 retval = [retval; tmp];
97 x = next_arg; 97 x = next_arg;
98 y_set = false; 98 y_set = false;
99 properties = {}; 99 properties = {};
100 else 100 else
101 y = next_arg; 101 y = next_arg;
102 y_set = true; 102 y_set = true;
103 endif 103 endif
104 else 104 else
105 x = next_arg; 105 x = next_arg;
106 x_set = true; 106 x_set = true;
107 endif 107 endif
108 108
109 endwhile 109 endwhile
110 110
111 else 111 else
236 236
237 k = 1; 237 k = 1;
238 if (x_nr == y_nr && x_nc == y_nc) 238 if (x_nr == y_nr && x_nc == y_nc)
239 if (x_nc > 0) 239 if (x_nc > 0)
240 if (numel (options) == 1) 240 if (numel (options) == 1)
241 options = repmat (options(:), x_nc, 1); 241 options = repmat (options(:), x_nc, 1);
242 endif 242 endif
243 retval = zeros (x_nc, 1); 243 retval = zeros (x_nc, 1);
244 for i = 1:x_nc 244 for i = 1:x_nc
245 tkey = options(i).key; 245 tkey = options(i).key;
246 if (! isempty (tkey)) 246 if (! isempty (tkey))
247 set (h, "key", "on"); 247 set (h, "key", "on");
248 endif 248 endif
249 linestyle = options(i).linestyle; 249 linestyle = options(i).linestyle;
250 marker = options(i).marker; 250 marker = options(i).marker;
251 if (isempty (marker) && isempty (linestyle)) 251 if (isempty (marker) && isempty (linestyle))
252 [linestyle, marker] = __next_line_style__ (); 252 [linestyle, marker] = __next_line_style__ ();
253 endif 253 endif
254 color = options(i).color; 254 color = options(i).color;
255 if (isempty (color)) 255 if (isempty (color))
256 color = __next_line_color__ (); 256 color = __next_line_color__ ();
257 endif 257 endif
258 258
259 retval(i) = line (x(:,i), y(:,i), "keylabel", tkey, "color", color, 259 retval(i) = line (x(:,i), y(:,i), "keylabel", tkey, "color", color,
260 "linestyle", linestyle, 260 "linestyle", linestyle,
261 "marker", marker, properties{:}); 261 "marker", marker, properties{:});
262 endfor 262 endfor
263 else 263 else
264 error ("__plt2mm__: arguments must be a matrices"); 264 error ("__plt2mm__: arguments must be a matrices");
265 endif 265 endif
266 else 266 else
310 endif 310 endif
311 retval = zeros (x_nc, 1); 311 retval = zeros (x_nc, 1);
312 for i = 1:x_nc 312 for i = 1:x_nc
313 tkey = options(i).key; 313 tkey = options(i).key;
314 if (! isempty (tkey)) 314 if (! isempty (tkey))
315 set (h, "key", "on"); 315 set (h, "key", "on");
316 endif 316 endif
317 linestyle = options(i).linestyle; 317 linestyle = options(i).linestyle;
318 marker = options(i).marker; 318 marker = options(i).marker;
319 if (isempty (marker) && isempty (linestyle)) 319 if (isempty (marker) && isempty (linestyle))
320 [linestyle, marker] = __next_line_style__ (); 320 [linestyle, marker] = __next_line_style__ ();
321 endif 321 endif
322 color = options(i).color; 322 color = options(i).color;
323 if (isempty (color)) 323 if (isempty (color))
324 color = __next_line_color__ (); 324 color = __next_line_color__ ();
325 endif 325 endif
326 326
327 retval(i) = line (x(:,i), y, "keylabel", tkey, "color", color, 327 retval(i) = line (x(:,i), y, "keylabel", tkey, "color", color,
328 "linestyle", linestyle, 328 "linestyle", linestyle,
329 "marker", marker, properties{:}); 329 "marker", marker, properties{:});
330 endfor 330 endfor
331 else 331 else
332 error ("__plt2mv__: arguments must be a matrices"); 332 error ("__plt2mv__: arguments must be a matrices");
333 endif 333 endif
334 334
369 if (isempty (color)) 369 if (isempty (color))
370 color = __next_line_color__ (); 370 color = __next_line_color__ ();
371 endif 371 endif
372 372
373 retval = line (x, y, "keylabel", key, "color", color, 373 retval = line (x, y, "keylabel", key, "color", color,
374 "linestyle", linestyle, 374 "linestyle", linestyle,
375 "marker", marker, properties{:}); 375 "marker", marker, properties{:});
376 else 376 else
377 error ("__plt2ss__: arguments must be scalars"); 377 error ("__plt2ss__: arguments must be scalars");
378 endif 378 endif
379 379
380 endfunction 380 endfunction
400 endif 400 endif
401 retval = zeros (len, 1); 401 retval = zeros (len, 1);
402 for i = 1:len 402 for i = 1:len
403 tkey = options(i).key; 403 tkey = options(i).key;
404 if (! isempty (tkey)) 404 if (! isempty (tkey))
405 set (h, "key", "on"); 405 set (h, "key", "on");
406 endif 406 endif
407 linestyle = options(i).linestyle; 407 linestyle = options(i).linestyle;
408 marker = options(i).marker; 408 marker = options(i).marker;
409 if (isempty (marker) && isempty (linestyle)) 409 if (isempty (marker) && isempty (linestyle))
410 [linestyle, marker] = __next_line_style__ (); 410 [linestyle, marker] = __next_line_style__ ();
411 endif 411 endif
412 color = options(i).color; 412 color = options(i).color;
413 if (isempty (color)) 413 if (isempty (color))
414 color = __next_line_color__ (); 414 color = __next_line_color__ ();
415 endif 415 endif
416 416
417 retval(i) = line (x, y(i), "keylabel", tkey, "color", color, 417 retval(i) = line (x, y(i), "keylabel", tkey, "color", color,
418 "linestyle", linestyle, 418 "linestyle", linestyle,
419 "marker", marker, properties{:}); 419 "marker", marker, properties{:});
420 endfor 420 endfor
421 else 421 else
422 error ("__plt2sv__: first arg must be scalar, second arg must be vector"); 422 error ("__plt2sv__: first arg must be scalar, second arg must be vector");
423 endif 423 endif
424 424
465 endif 465 endif
466 retval = zeros (y_nc, 1); 466 retval = zeros (y_nc, 1);
467 for i = 1:y_nc 467 for i = 1:y_nc
468 tkey = options(i).key; 468 tkey = options(i).key;
469 if (! isempty (tkey)) 469 if (! isempty (tkey))
470 set (h, "key", "on"); 470 set (h, "key", "on");
471 endif 471 endif
472 linestyle = options(i).linestyle; 472 linestyle = options(i).linestyle;
473 marker = options(i).marker; 473 marker = options(i).marker;
474 if (isempty (marker) && isempty (linestyle)) 474 if (isempty (marker) && isempty (linestyle))
475 [linestyle, marker] = __next_line_style__ (); 475 [linestyle, marker] = __next_line_style__ ();
476 endif 476 endif
477 color = options(i).color; 477 color = options(i).color;
478 if (isempty (color)) 478 if (isempty (color))
479 color = __next_line_color__ (); 479 color = __next_line_color__ ();
480 endif 480 endif
481 481
482 retval(i) = line (x, y(:,i), "keylabel", tkey, "color", color, 482 retval(i) = line (x, y(:,i), "keylabel", tkey, "color", color,
483 "linestyle", linestyle, 483 "linestyle", linestyle,
484 "marker", marker, properties{:}); 484 "marker", marker, properties{:});
485 endfor 485 endfor
486 else 486 else
487 error ("__plt2vm__: arguments must be a matrices"); 487 error ("__plt2vm__: arguments must be a matrices");
488 endif 488 endif
489 489
510 endif 510 endif
511 retval = zeros (len, 1); 511 retval = zeros (len, 1);
512 for i = 1:len 512 for i = 1:len
513 tkey = options(i).key; 513 tkey = options(i).key;
514 if (! isempty (tkey)) 514 if (! isempty (tkey))
515 set (h, "key", "on"); 515 set (h, "key", "on");
516 endif 516 endif
517 linestyle = options(i).linestyle; 517 linestyle = options(i).linestyle;
518 marker = options(i).marker; 518 marker = options(i).marker;
519 if (isempty (marker) && isempty (linestyle)) 519 if (isempty (marker) && isempty (linestyle))
520 [linestyle, marker] = __next_line_style__ (); 520 [linestyle, marker] = __next_line_style__ ();
521 endif 521 endif
522 color = options(i).color; 522 color = options(i).color;
523 if (isempty (color)) 523 if (isempty (color))
524 color = __next_line_color__ (); 524 color = __next_line_color__ ();
525 endif 525 endif
526 526
527 retval(i) = line (x(i), y, "keylabel", tkey, "color", color, 527 retval(i) = line (x(i), y, "keylabel", tkey, "color", color,
528 "linestyle", linestyle, 528 "linestyle", linestyle,
529 "marker", marker, properties{:}); 529 "marker", marker, properties{:});
530 endfor 530 endfor
531 else 531 else
532 error ("__plt2vs__: first arg must be vector, second arg must be scalar"); 532 error ("__plt2vs__: first arg must be vector, second arg must be scalar");
533 endif 533 endif
534 534
583 if (isempty (color)) 583 if (isempty (color))
584 color = __next_line_color__ (); 584 color = __next_line_color__ ();
585 endif 585 endif
586 586
587 retval = line (x, y, "keylabel", key, "color", color, 587 retval = line (x, y, "keylabel", key, "color", color,
588 "linestyle", linestyle, 588 "linestyle", linestyle,
589 "marker", marker, properties{:}); 589 "marker", marker, properties{:});
590 else 590 else
591 error ("__plt2vv__: vector lengths must match"); 591 error ("__plt2vv__: vector lengths must match");
592 endif 592 endif
593 593
594 endfunction 594 endfunction