Mercurial > hg > octave-lyh
diff scripts/plot/plot3.m @ 10549:95c3e38098bf
Untabify .m scripts
author | Rik <code@nomad.inbox5.com> |
---|---|
date | Fri, 23 Apr 2010 11:28:50 -0700 |
parents | 4516a0c97ced |
children | e81914f3921f |
line wrap: on
line diff
--- a/scripts/plot/plot3.m +++ b/scripts/plot/plot3.m @@ -112,84 +112,84 @@ if (ischar (new)) if (! z_set) - if (! y_set) - if (! x_set) - error ("plot3: needs x, [ y, [ z ] ]"); - else - z = imag (x); - y = real (x); - y_set = 1; - z_set = 1; - if (rows(x) > 1) - x = repmat ((1:rows(x))', 1, columns(x)); - else - x = 1:columns(x); - endif - endif - else - z = imag (y); - y = real (y); - z_set = 1; - endif + if (! y_set) + if (! x_set) + error ("plot3: needs x, [ y, [ z ] ]"); + else + z = imag (x); + y = real (x); + y_set = 1; + z_set = 1; + if (rows(x) > 1) + x = repmat ((1:rows(x))', 1, columns(x)); + else + x = 1:columns(x); + endif + endif + else + z = imag (y); + y = real (y); + z_set = 1; + endif endif if (! fmt_set) - [options, valid] = __pltopt__ ("plot3", new, false); - if (! valid) - properties = [properties, new_cell]; - property_set = 1; - continue; - else - fmt_set = 1; - while (arg < nargin && ischar (varargin{arg+1})) - if (nargin - arg < 2) - error ("plot3: properties must appear followed by a value"); - endif - properties = [properties, varargin(arg+1:arg+2)]; - arg += 2; - endwhile - endif + [options, valid] = __pltopt__ ("plot3", new, false); + if (! valid) + properties = [properties, new_cell]; + property_set = 1; + continue; + else + fmt_set = 1; + while (arg < nargin && ischar (varargin{arg+1})) + if (nargin - arg < 2) + error ("plot3: properties must appear followed by a value"); + endif + properties = [properties, varargin(arg+1:arg+2)]; + arg += 2; + endwhile + endif else - properties = [properties, new_cell]; - property_set = 1; - continue; + properties = [properties, new_cell]; + property_set = 1; + continue; endif if (isvector (x) && isvector (y)) - if (isvector (z)) - x = x(:); - y = y(:); - z = z(:); - elseif (length (x) == rows (z) && length (y) == columns (z)) - [x, y] = meshgrid (x, y); - else - error ("plot3: [length(x), length(y)] must match size(z)"); - endif + if (isvector (z)) + x = x(:); + y = y(:); + z = z(:); + elseif (length (x) == rows (z) && length (y) == columns (z)) + [x, y] = meshgrid (x, y); + else + error ("plot3: [length(x), length(y)] must match size(z)"); + endif endif if (! size_equal (x, y, z)) - error ("plot3: x, y, and z must have the same shape"); + error ("plot3: x, y, and z must have the same shape"); endif key = options.key; if (! isempty (key)) - set (gca (), "key", "on"); + set (gca (), "key", "on"); endif for i = 1 : columns (x) linestyle = options.linestyle; marker = options.marker; - if (isempty (marker) && isempty (linestyle)) - [linestyle, marker] = __next_line_style__ (); - endif - color = options.color; - if (isempty (options.color)) - color = __next_line_color__ (); - endif + if (isempty (marker) && isempty (linestyle)) + [linestyle, marker] = __next_line_style__ (); + endif + color = options.color; + if (isempty (options.color)) + color = __next_line_color__ (); + endif - tmp(++idx) = line (x(:, i), y(:, i), z(:, i), "keylabel", key, - "color", color, "linestyle", linestyle, - "marker", marker, properties{:}); + tmp(++idx) = line (x(:, i), y(:, i), z(:, i), "keylabel", key, + "color", color, "linestyle", linestyle, + "marker", marker, properties{:}); endfor x_set = 0; @@ -208,41 +208,41 @@ z_set = 1; else if (isvector (x) && isvector (y)) - if (isvector (z)) - x = x(:); - y = y(:); - z = z(:); - elseif (length (x) == rows (z) && length (y) == columns (z)) - [x, y] = meshgrid (x, y); - else - error ("plot3: [length(x), length(y)] must match size(z)"); - endif + if (isvector (z)) + x = x(:); + y = y(:); + z = z(:); + elseif (length (x) == rows (z) && length (y) == columns (z)) + [x, y] = meshgrid (x, y); + else + error ("plot3: [length(x), length(y)] must match size(z)"); + endif endif if (! size_equal (x, y, z)) - error ("plot3: x, y, and z must have the same shape"); + error ("plot3: x, y, and z must have the same shape"); endif options = __default_plot_options__ (); key = options.key; if (! isempty (key)) - set (gca (), "key", "on"); + set (gca (), "key", "on"); endif for i = 1 : columns (x) linestyle = options.linestyle; marker = options.marker; - if (isempty (marker) && isempty (linestyle)) - [linestyle, marker] = __next_line_style__ (); - endif - color = options.color; - if (isempty (color)) - color = __next_line_color__ (); - endif + if (isempty (marker) && isempty (linestyle)) + [linestyle, marker] = __next_line_style__ (); + endif + color = options.color; + if (isempty (color)) + color = __next_line_color__ (); + endif - tmp(++idx) = line (x(:, i), y(:, i), z(:, i), "keylabel", key, - "color", color, "linestyle", linestyle, - "marker", marker, properties{:}); + tmp(++idx) = line (x(:, i), y(:, i), z(:, i), "keylabel", key, + "color", color, "linestyle", linestyle, + "marker", marker, properties{:}); endfor x = new; @@ -263,9 +263,9 @@ if (x_set) if (y_set) if (! z_set) - z = imag (y); - y = real (y); - z_set = 1; + z = imag (y); + y = real (y); + z_set = 1; endif else z = imag (x); @@ -273,21 +273,21 @@ y_set = 1; z_set = 1; if (rows (x) > 1) - x = repmat ((1:rows (x))', 1, columns(x)); + x = repmat ((1:rows (x))', 1, columns(x)); else - x = 1:columns(x); + x = 1:columns(x); endif endif if (isvector (x) && isvector (y)) if (isvector (z)) - x = x(:); - y = y(:); - z = z(:); + x = x(:); + y = y(:); + z = z(:); elseif (length (x) == rows (z) && length (y) == columns (z)) - [x, y] = meshgrid (x, y); + [x, y] = meshgrid (x, y); else - error ("plot3: [length(x), length(y)] must match size(z)"); + error ("plot3: [length(x), length(y)] must match size(z)"); endif endif @@ -305,16 +305,16 @@ linestyle = options.linestyle; marker = options.marker; if (isempty (marker) && isempty (linestyle)) - [linestyle, marker] = __next_line_style__ (); + [linestyle, marker] = __next_line_style__ (); endif color = options.color; if (isempty (color)) - color = __next_line_color__ (); + color = __next_line_color__ (); endif tmp(++idx) = line (x(:, i), y(:, i), z(:, i), "keylabel", key, - "color", color, "linestyle", linestyle, - "marker", marker, properties{:}); + "color", color, "linestyle", linestyle, + "marker", marker, properties{:}); endfor endif