# HG changeset patch # User John W. Eaton # Date 1223341565 14400 # Node ID 73d6b71788c066dcf57a810fee00b467ec1d0a60 # Parent 8e8afefe9466b9fe0b75a394888029be293d3020 use case-insensitive comparison for graphics properties; misc style fixes diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,16 @@ +2008-10-06 John W. Eaton + + * plot/__add_datasource__.m, plot/__axes_limits__.m, + plot/__bar__.m, plot/__bars__.m, plot/__contour__.m, + plot/__go_draw_axes__.m, plot/__go_draw_figure__.m, + plot/__patch__.m, plot/__quiver__.m, plot/__scatter__.m, + plot/__stem__.m, plot/ancestor.m, plot/axis.m, plot/box.m, + plot/caxis.m, plot/close.m, plot/colorbar.m, plot/fill.m, + plot/findobj.m, plot/grid.m, plot/hidden.m, plot/hold.m, + plot/ishold.m, plot/legend.m, plot/linkprop.m, plot/orient.m, + plot/plotmatrix.m, plot/shading.m: Use case-insensitive comparison + for properties. Misc style fixes. + 2008-10-06 Ben Abbott * plot/orient.m: Figure handle must be scalar. diff --git a/scripts/plot/__add_datasource__.m b/scripts/plot/__add_datasource__.m --- a/scripts/plot/__add_datasource__.m +++ b/scripts/plot/__add_datasource__.m @@ -36,14 +36,14 @@ newargs = {}; while (i < numel (varargin)) arg = varargin{++i}; - if (i != numel(varargin) && ischar (arg) && - length (arg > 1) && strcmpi (arg(2:end), "datasource")) + if (i != numel(varargin) && ischar (arg) + && length (arg) > 1 && strcmpi (arg(2:end), "datasource")) arg = tolower (arg); val = varargin{++i}; if (ischar (val)) - set (h, arg, val); + set (h, arg, val); else - error ("%s: expecting data source to be a string", fcn); + error ("%s: expecting data source to be a string", fcn); endif else newargs{end + 1} = arg; diff --git a/scripts/plot/__axes_limits__.m b/scripts/plot/__axes_limits__.m --- a/scripts/plot/__axes_limits__.m +++ b/scripts/plot/__axes_limits__.m @@ -32,18 +32,16 @@ arg = varargin{1}; if (ischar (arg)) - arg = tolower (arg); - if (strcmp ("mode", arg)) - + if (strcmpi (arg, "mode")) retval = get (h, fcnmode); - elseif (strcmp ("auto", arg) || strcmp ("manual", arg)) + elseif (strcmpi (arg, "auto") || strcmpi (arg, "manual")) set (h, fcnmode, arg); endif else if (!isnumeric (arg) && any (size(arg(:)) != [2, 1])) error ("%s: argument must be a 2 element vector", fcn); else - set (h, fcn, arg (:)); + set (h, fcn, arg(:)); endif endif endif diff --git a/scripts/plot/__bar__.m b/scripts/plot/__bar__.m --- a/scripts/plot/__bar__.m +++ b/scripts/plot/__bar__.m @@ -67,10 +67,10 @@ newargs = {}; have_line_spec = false; while (idx <= nargin - 2) - if (ischar (varargin{idx}) && strcmp (varargin{idx}, "grouped")) + if (ischar (varargin{idx}) && strcmpi (varargin{idx}, "grouped")) group = true; idx++; - elseif (ischar (varargin{idx}) && strcmp (varargin{idx}, "stacked")) + elseif (ischar (varargin{idx}) && strcmpi (varargin{idx}, "stacked")) group = false; idx++; else @@ -88,8 +88,9 @@ width = varargin{idx++}; elseif (idx == nargin - 2) newargs = [newargs,varargin(idx++)]; - elseif (ischar (varargin{idx}) && strcmp (tolower (varargin{idx}), "basevalue") && - isscalar (varargin{idx+1})) + elseif (ischar (varargin{idx}) + && strcmpi (varargin{idx}, "basevalue") + && isscalar (varargin{idx+1})) bv = varargin{idx+1}; idx += 2; else diff --git a/scripts/plot/__bars__.m b/scripts/plot/__bars__.m --- a/scripts/plot/__bars__.m +++ b/scripts/plot/__bars__.m @@ -148,10 +148,10 @@ if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline") && obj.baseline == h) ## Only alter if changed to avoid recursion of the listener functions - if (! strcmp (get (kids(i), "showbaseline"), visible)) + if (! strcmpi (get (kids(i), "showbaseline"), visible)) set (kids (i), "showbaseline", visible); endif - if (! strcmp (get (kids(i), "basevalue"), visible)) + if (! strcmpi (get (kids(i), "basevalue"), visible)) set (kids (i), "basevalue", ydata); endif endif @@ -187,7 +187,7 @@ set (bl, "ydata", [b0, b0]); endif - if (strcmp (get (h, "barlayout"), "grouped")) + if (strcmpi (get (h, "barlayout"), "grouped")) update_data (h, d); endif endfunction @@ -221,7 +221,7 @@ [xb, yb] = bar (x, y, get (h, "barwidth"), get (h, "barlayout"), "basevalue", get (h, "basevalue")); ny = columns (y); - vert = strcmp (get (h, "horizontal"), "off"); + vert = strcmpi (get (h, "horizontal"), "off"); for i = 1:ny hp = get (hlist(i), "children"); @@ -255,10 +255,10 @@ if (get (hh, "barwidth") != barwidth) set (hh, "barwidth", barwidth); endif - if (! strcmp (get (hh, "barlayout"), barlayout)) + if (! strcmpi (get (hh, "barlayout"), barlayout)) set (hh, "barlayout", barlayout); endif - if (! strcmp (get (hh, "horizontal"), horizontal)) + if (! strcmpi (get (hh, "horizontal"), horizontal)) set (hh, "horizontal", horizontal); endif endif diff --git a/scripts/plot/__contour__.m b/scripts/plot/__contour__.m --- a/scripts/plot/__contour__.m +++ b/scripts/plot/__contour__.m @@ -54,12 +54,12 @@ endwhile if (ischar (z)) - if (strcmp (z, "none")) + if (strcmpi (z, "none")) z = NaN; - elseif (strcmp (z, "base")) + elseif (strcmpi (z, "base")) z = varargin{3}; z = 2 * (min (z(:)) - max (z(:))); - elseif (! strcmp (z, "level")) + elseif (! strcmpi (z, "level")) error ("unrecognized z argument"); endif endif diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -311,7 +311,7 @@ obj = get (kids(1)); kids = kids(2:end); - if (strcmp (obj.visible, "off")) + if (strcmpi (obj.visible, "off")) continue; endif @@ -1558,9 +1558,9 @@ str = getfield (obj, fld); if (enhanced) - if (strcmp (obj.interpreter, "tex")) + if (strcmpi (obj.interpreter, "tex")) str = __tex2enhanced__ (str, fnt, it, bld); - elseif (strcmp (obj.interpreter, "latex")) + elseif (strcmpi (obj.interpreter, "latex")) if (! warned_latex) warning ("latex text objects not supported"); warned_latex = true; @@ -1616,7 +1616,7 @@ str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', str(s(i) + 3:end)); endif - elseif (strcmp (f, "color")) + elseif (strcmpi (f, "color")) ## FIXME Ignore \color but remove trailing {} block as well d = strfind(str(e(i) + 1:end),'}'); if (isempty (d)) @@ -1624,7 +1624,7 @@ else str = cstrcat (str(1:s(i) - 1), str(e(i) + d + 1:end)); endif - elseif(strcmp (f, "fontname")) + elseif(strcmpi (f, "fontname")) b1 = strfind(str(e(i) + 1:end),'{'); b2 = strfind(str(e(i) + 1:end),'}'); if (isempty(b1) || isempty(b2)) @@ -1634,7 +1634,7 @@ str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', str(e(i) + b2(1) + 1:end)); endif - elseif(strcmp (f, "fontsize")) + elseif(strcmpi (f, "fontsize")) b1 = strfind(str(e(i) + 1:end),'{'); b2 = strfind(str(e(i) + 1:end),'}'); if (isempty(b1) || isempty(b2)) diff --git a/scripts/plot/__go_draw_figure__.m b/scripts/plot/__go_draw_figure__.m --- a/scripts/plot/__go_draw_figure__.m +++ b/scripts/plot/__go_draw_figure__.m @@ -38,7 +38,7 @@ case "axes" axes_count++; ## Force multiplot with a colorbar to ensure colorbar on the page - if (!strcmp (obj.__colorbar__, "none")) + if (!strcmpi (obj.__colorbar__, "none")) axes_count++; endif endswitch diff --git a/scripts/plot/__patch__.m b/scripts/plot/__patch__.m --- a/scripts/plot/__patch__.m +++ b/scripts/plot/__patch__.m @@ -53,22 +53,22 @@ iarg++; endif elseif (ischar (varargin{1}) - && (strcmp (tolower (varargin{1}), "faces") - || strcmp (tolower (varargin{1}), "vertices"))) + && (strcmpi (varargin{1}, "faces") + || strcmpi (varargin{1}, "vertices"))) if (! isnumeric (varargin{2})) fail = true; return; endif - if (strcmp (tolower (varargin{1}), "faces")) + if (strcmpi (varargin{1}, "faces")) faces = varargin{2}; - if (strcmp (tolower (varargin{3}), "vertices")) + if (strcmpi (varargin{3}, "vertices")) vert = varargin{4}; have_faces = true; endif - elseif (strcmp (tolower (varargin{3}), "vertices")) + elseif (strcmpi (varargin{3}, "vertices")) vert = varargin{2}; - if (strcmp (tolower (varargin{3}), "faces")) + if (strcmpi (varargin{3}, "faces")) faces = varargin{4}; have_faces = true; endif diff --git a/scripts/plot/__quiver__.m b/scripts/plot/__quiver__.m --- a/scripts/plot/__quiver__.m +++ b/scripts/plot/__quiver__.m @@ -78,7 +78,7 @@ args = {}; while (ioff <= nargin) arg = varargin{ioff++}; - if (ischar (arg) && strncmp (tolower (arg), "filled", 6)) + if (ischar (arg) && strncmpi (arg, "filled", 6)) have_filled = true; elseif ((ischar (arg) || iscell (arg)) && ! have_line_spec) @@ -324,7 +324,7 @@ is3d = true; endif - if (strcmp (get (h, "autoscale"), "on") && s != 0) + if (strcmpi (get (h, "autoscale"), "on") && s != 0) ## Scale the arrows to fit in the grid dx = (max(x(:)) - min(x(:))) ./ size (x, 2); dy = (max(y(:)) - min(y(:))) ./ size (y, 1); @@ -400,7 +400,7 @@ set (kids(2), "color", get (h, "color"), "linewidth", get (h, "linewidth"), "linestyle", get (h, "linestyle")); - if (strcmp (get (h, "showarrowhead"), "on")) + if (strcmpi (get (h, "showarrowhead"), "on")) set (kids (2), "visible", "on"); else set (kids (2), "visible", "off"); diff --git a/scripts/plot/__scatter__.m b/scripts/plot/__scatter__.m --- a/scripts/plot/__scatter__.m +++ b/scripts/plot/__scatter__.m @@ -77,7 +77,7 @@ iarg = firstnonnumeric; while (iarg <= nargin) arg = varargin{iarg++}; - if (ischar (arg) && strncmp (tolower (arg), "filled", 6)) + if (ischar (arg) && strncmpi (arg, "filled", 6)) filled = true; elseif ((ischar (arg) || iscell (arg)) && ! have_marker) [linespec, valid] = __pltopt__ ("scatter", arg, false); @@ -99,16 +99,16 @@ endwhile if (ischar (c)) - h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor", - "none", "edgecolor", c, "marker", marker, - "markersize", s, "linestyle", "none"); + h = patch ("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor", + "none", "edgecolor", c, "marker", marker, + "markersize", s, "linestyle", "none"); if (filled) set(h, "markerfacecolor", c); endif else - h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor", - "none", "edgecolor", "flat", "cdata", c, "marker", marker, - "markersize", s, "linestyle", "none"); + h = patch ("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor", + "none", "edgecolor", "flat", "cdata", c, "marker", marker, + "markersize", s, "linestyle", "none"); if (filled) set(h, "markerfacecolor", "flat"); endif diff --git a/scripts/plot/__stem__.m b/scripts/plot/__stem__.m --- a/scripts/plot/__stem__.m +++ b/scripts/plot/__stem__.m @@ -169,8 +169,8 @@ i = 2; newargs = {}; while (i < length (varargin)) - if (ischar (varargin{i}) && !(strcmpi ("fill", varargin{i}) || - strcmpi ("filled", varargin{i}))) + if (ischar (varargin{i}) && !(strcmpi ("fill", varargin{i}) + || strcmpi ("filled", varargin{i}))) newargs{end + 1} = varargin{i}; newargs{end + 1} = varargin{i + 1}; nargin = nargin - 2; @@ -292,14 +292,14 @@ if (! have_z) ## varargin{3} must be char ## check for "fill - if ((strcmpi ("fill", varargin{3}) || strcmpi ("filled", varargin{3})) + if ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled")) && fill_2) error ("stem: duplicate fill argument"); - elseif (strcmp("fill", varargin{3}) && linespec_2) + elseif (strcmpi ("fill", varargin{3}) && linespec_2) ## must be "fill" dofill = 1; fill_2 = 1; - elseif ((strcmpi ("fill", varargin{3}) || strcmpi ("filled", varargin{3})) + elseif ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled")) && !linespec_2) ## must be "fill" dofill = 1; @@ -327,7 +327,7 @@ endif if (! have_z) - if (strcmpi ("fill", varargin{3}) || strcmpi ("filled", varargin{3})) + if (strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled")) dofill = 1; fill_2 = 1; # be sure, no second "fill" is in the arguments else @@ -338,15 +338,15 @@ endif ## check for "fill" .. - if ((strcmpi ("fill", varargin{4}) || strcmpi ("filled", varargin{4})) + if ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled")) && fill_2) error ("%s: duplicate fill argument", caller); - elseif ((strcmpi ("fill", varargin{4}) || strcmpi ("filled", varargin{4})) + elseif ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled")) && linespec_2) ## must be "fill" dofill = 1; fill_2 = 1; - elseif (!strcmpi ("fill", varargin{4}) && !strcmpi ("filled", varargin{4}) + elseif (!strcmpi (varargin{4}, "fill") && !strcmpi (varargin{4}, "filled") && !linespec_2) ## must be linespec [lc, ls, mc, ms] = stem_line_spec (caller, varargin{4}); @@ -360,7 +360,7 @@ error ("stem3: X, Y and Z must be matrices"); endif - if (strcmpi ("fill", varargin{4}) || strcmpi ("filled", varargin{4})) + if (strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled")) dofill = 1; fill_2 = 1; # be sure, no second "fill" is in the arguments else @@ -370,16 +370,16 @@ endif ## check for "fill" .. - if ((strcmpi ("fill", varargin{5}) || strcmpi ("filled", varargin{5})) + if ((strcmpi (varargin{5}, "fill") || strcmpi (varargin{5}, "filled")) && fill_2) error ("stem3: duplicate fill argument"); - elseif ((strcmpi ("fill", varargin{5}) || strcmpi ("filled", varargin{5})) + elseif ((strcmpi (varargin{5}, "fill") || strcmpi (varargin{5}, "filled")) && linespec_2) ## must be "fill" dofill = 1; fill_2 = 1; - elseif (!strcmpi ("fill", varargin{5}) && !strcmpi ("filled", varargin{5}) - && !linespec_2) + elseif (!strcmpi (varargin{5}, "fill") && !strcmpi (varargin{5}, "filled") + && !linespec_2) ## must be linespec [lc, ls, mc, ms] = stem_line_spec (caller, varargin{5}); linespec_2 = 1; @@ -433,7 +433,7 @@ mc = lc = cur_props(i).color; elseif (isfield (cur_props(i), "linestyle")) ls = cur_props(i).linestyle; - elseif (isfield (cur_props(i), "marker") && ! strcmp (cur_props(i).marker, "none")) + elseif (isfield (cur_props(i), "marker") && ! strcmpi (cur_props(i).marker, "none")) ms = cur_props(i).marker; endif endfor @@ -471,10 +471,10 @@ if (strcmp (obj.type, "hggroup") && isfield (obj, "baseline") && obj.baseline == h) ## Only alter if changed to avoid recursion of the listener functions - if (! strcmp (get (kids(i), "showbaseline"), visible)) + if (! strcmpi (get (kids(i), "showbaseline"), visible)) set (kids (i), "showbaseline", visible); endif - if (! strcmp (get (kids(i), "basevalue"), visible)) + if (! strcmpi (get (kids(i), "basevalue"), visible)) set (kids (i), "basevalue", ydata); endif endif diff --git a/scripts/plot/ancestor.m b/scripts/plot/ancestor.m --- a/scripts/plot/ancestor.m +++ b/scripts/plot/ancestor.m @@ -42,7 +42,7 @@ if (iscellstr (type)) look_first = true; if (nargin == 3) - if (ischar (toplevel) && strcmp (toplevel, "toplevel")) + if (ischar (toplevel) && strcmpi (toplevel, "toplevel")) look_first = false; else error ("ancestor: third argument must be \"toplevel\""); diff --git a/scripts/plot/axis.m b/scripts/plot/axis.m --- a/scripts/plot/axis.m +++ b/scripts/plot/axis.m @@ -148,26 +148,25 @@ endif elseif (ischar (ax)) - ax = tolower (ax); len = length (ax); ## 'matrix mode' to reverse the y-axis - if (strcmp (ax, "ij")) + if (strcmpi (ax, "ij")) set (ca, "ydir", "reverse"); - elseif (strcmp (ax, "xy")) + elseif (strcmpi (ax, "xy")) set (ca, "ydir", "normal"); ## aspect ratio - elseif (strcmp (ax, "image")) + elseif (strcmpi (ax, "image")) set (ca, "dataaspectratio", [1, 1, 1]); __do_tight_option__ (ca); - elseif (strcmp (ax, "equal") || strcmp (ax, "square")) + elseif (strcmpi (ax, "equal") || strcmpi (ax, "square")) set (ca, "dataaspectratio", [1, 1, 1]); - elseif (strcmp (ax, "normal")) + elseif (strcmpi (ax, "normal")) set (ca, "dataaspectratiomode", "auto"); ## axis limits - elseif (len >= 4 && strcmp (ax(1:4), "auto")) + elseif (len >= 4 && strcmpi (ax(1:4), "auto")) if (len > 4) if (any (ax == "x")) set (ca, "xlimmode", "auto"); @@ -181,23 +180,23 @@ else set (ca, "xlimmode", "auto", "ylimmode", "auto", "zlimmode", "auto"); endif - elseif (strcmp (ax, "manual")) + elseif (strcmpi (ax, "manual")) ## fixes the axis limits, like axis(axis) should; set (ca, "xlimmode", "manual", "ylimmode", "manual", "zlimmode", "manual"); - elseif (strcmp (ax, "tight")) + elseif (strcmpi (ax, "tight")) ## sets the axis limits to the min and max of all data. __do_tight_option__ (ca); ## tic marks - elseif (strcmp (ax, "on") || strcmp (ax, "tic")) + elseif (strcmpi (ax, "on") || strcmpi (ax, "tic")) set (ca, "xtickmode", "auto", "ytickmode", "auto", "ztickmode", "auto"); set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto", "zticklabelmode", "auto"); set (ca, "visible", "on"); - elseif (strcmp (ax, "off")) + elseif (strcmpi (ax, "off")) set (ca, "xtick", [], "ytick", [], "ztick", []); set (ca, "visible", "off"); - elseif (len > 3 && strcmp (ax(1:3), "tic")) + elseif (len > 3 && strcmpi (ax(1:3), "tic")) if (any (ax == "x")) set (ca, "xtickmode", "auto"); else @@ -213,12 +212,12 @@ else set (ca, "ztick", []); endif - elseif (strcmp (ax, "label")) + elseif (strcmpi (ax, "label")) set (ca, "xticklabelmode", "auto", "yticklabelmode", "auto", "zticklabelmode", "auto"); - elseif (strcmp (ax, "nolabel")) + elseif (strcmpi (ax, "nolabel")) set (ca, "xticklabel", "", "yticklabel", "", "zticklabel", ""); - elseif (len > 5 && strcmp (ax(1:5), "label")) + elseif (len > 5 && strcmpi (ax(1:5), "label")) if (any (ax == "x")) set (ca, "xticklabelmode", "auto"); else diff --git a/scripts/plot/box.m b/scripts/plot/box.m --- a/scripts/plot/box.m +++ b/scripts/plot/box.m @@ -38,7 +38,7 @@ nargs = numel (varargin); if (nargs == 0) - if (strcmp (box_state, "on")) + if (strcmpi (box_state, "on")) box_state = "off"; else box_state = "on"; @@ -46,9 +46,9 @@ elseif (nargs == 1) state = varargin{1}; if (ischar (state)) - if (strcmp ("off", state)) + if (strcmpi (state, "off")) box_state = "off"; - elseif (strcmp ("on", state)) + elseif (strcmpi (state, "on")) box_state = "on"; else print_usage (); diff --git a/scripts/plot/caxis.m b/scripts/plot/caxis.m --- a/scripts/plot/caxis.m +++ b/scripts/plot/caxis.m @@ -65,10 +65,9 @@ cmin = cmin(1); endif elseif (ischar (ax)) - ax = tolower (ax); - if (strcmp (ax, "auto")) + if (strcmpi (ax, "auto")) set (ca, "climmode", "auto"); - elseif (strcmp (ax, "manual")) + elseif (strcmpi (ax, "manual")) set (ca, "climmode", "manual"); endif elseif (isvector (ax)) diff --git a/scripts/plot/close.m b/scripts/plot/close.m --- a/scripts/plot/close.m +++ b/scripts/plot/close.m @@ -43,7 +43,7 @@ figs = []; endif elseif (nargin == 1) - if (ischar (arg1) && strcmp (arg1, "all")) + if (ischar (arg1) && strcmpi (arg1, "all")) close_all_figures (false); elseif (isfigure (arg1)) figs = arg1; @@ -51,8 +51,8 @@ error ("close: expecting argument to be \"all\" or a figure handle"); endif elseif (nargin == 2 - && ischar (arg1) && strcmp (arg1, "all") - && ischar (arg2) && strcmp (arg2, "hidden")) + && ischar (arg1) && strcmpi (arg1, "all") + && ischar (arg2) && strcmpi (arg2, "hidden")) close_all_figures (true); else print_usage (); @@ -72,7 +72,7 @@ while (! isempty (fig = get (0, "currentfigure"))) ## handlevisibility = get (fig, "handlevisibility") - ## if (close_hidden_figs || ! strcmp (handlevisibility, "off")) + ## if (close_hidden_figs || ! strcmpi (handlevisibility, "off")) close (fig); ## endif endwhile diff --git a/scripts/plot/colorbar.m b/scripts/plot/colorbar.m --- a/scripts/plot/colorbar.m +++ b/scripts/plot/colorbar.m @@ -51,7 +51,7 @@ function colorbar (varargin) - if (nargin > 0 && strcmpi(varargin{1}, "peer")) + if (nargin > 0 && strcmpi (varargin{1}, "peer")) if (nargin > 1) ax = varargin{2}; if (!isscalar (ax) || ! ishandle (ax) @@ -71,13 +71,12 @@ if (length(arg) < 1) pos = "eastoutside"; elseif (ischar (arg)) - arg = tolower (arg); - if (strcmp (arg, "off") || strcmp (arg, "none")) + if (strcmpi (arg, "off") || strcmpi (arg, "none")) pos = "none"; - elseif (strcmp (arg, "north") || strcmp (arg, "south") - || strcmp (arg, "east") || strcmp (arg, "west") - || strcmp (arg, "northoutside") || strcmp (arg, "southoutside") - || strcmp (arg, "eastoutside") || strcmp (arg, "westoutside")) + elseif (strcmpi (arg, "north") || strcmpi (arg, "south") + || strcmpi (arg, "east") || strcmpi (arg, "west") + || strcmpi (arg, "northoutside") || strcmpi (arg, "southoutside") + || strcmpi (arg, "eastoutside") || strcmpi (arg, "westoutside")) pos = arg; else error ("colorbar: unrecognized position argument"); diff --git a/scripts/plot/fill.m b/scripts/plot/fill.m --- a/scripts/plot/fill.m +++ b/scripts/plot/fill.m @@ -64,8 +64,9 @@ i = 1; while (i < nargin) iargs (end + 1) = i; - if (ischar (varargin{i}) && (strcmp (tolower (varargin{i}), "faces") || - strcmp (tolower (varargin{i}), "vertices"))) + if (ischar (varargin{i}) + && (strcmpi (varargin{i}, "faces") + || strcmpi (varargin{i}, "vertices"))) i += 4; elseif (isnumeric (varargin{i})) i += 2; @@ -74,8 +75,8 @@ if (i <= nargin) while (true); if (ischar (varargin{i}) && - (strcmp (tolower (varargin{i}), "faces") || - strcmp (tolower (varargin{i}), "vertices"))) + (strcmpi (varargin{i}, "faces") + || strcmpi (varargin{i}, "vertices"))) break; elseif (isnumeric (varargin{i})) ## Assume its the colorspec @@ -85,16 +86,16 @@ colspec = tolower (varargin{i}); collen = length (colspec); - if (strncmp (colspec, "blue", collen) || - strncmp (colspec, "black", collen) || - strncmp (colspec, "k", collen) || - strncmp (colspec, "black", collen) || - strncmp (colspec, "red", collen) || - strncmp (colspec, "green", collen) || - strncmp (colspec, "yellow", collen) || - strncmp (colspec, "magenta", collen) || - strncmp (colspec, "cyan", collen) || - strncmp (colspec, "white", collen)) + if (strncmp (colspec, "blue", collen) + || strncmp (colspec, "black", collen) + || strncmp (colspec, "k", collen) + || strncmp (colspec, "black", collen) + || strncmp (colspec, "red", collen) + || strncmp (colspec, "green", collen) + || strncmp (colspec, "yellow", collen) + || strncmp (colspec, "magenta", collen) + || strncmp (colspec, "cyan", collen) + || strncmp (colspec, "white", collen)) i++; break; endif diff --git a/scripts/plot/findobj.m b/scripts/plot/findobj.m --- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -78,10 +78,10 @@ endif if (n1 <= nargin) if (ischar (varargin{n1})) - if (strcmpi (varargin{n1}, 'flat')) + if (strcmpi (varargin{n1}, "flat")) depth = 0; n1 = n1 + 1; - elseif (strcmpi(varargin{n1}, '-depth')) + elseif (strcmpi (varargin{n1}, "-depth")) depth = varargin{n1+1}; n1 = n1 + 2; endif @@ -108,9 +108,9 @@ while (na <= numel (args)) regularexpression(np) = 0; property(np) = 0; - logicaloperator{np} = 'and'; + logicaloperator{np} = "and"; if (ischar (args{na})) - if (strcmpi(args{na}, '-regexp')) + if (strcmpi (args{na}, "-regexp")) if (na + 2 <= numel (args)) regularexpression(np) = 1; na = na + 1; @@ -122,7 +122,7 @@ else error ("findobj: inconsistent number of arguments"); endif - elseif (strcmpi(args{na}, '-property')) + elseif (strcmpi (args{na}, "-property")) if (na + 1 <= numel (args)) na = na + 1; property(np) = 1; @@ -133,7 +133,7 @@ else error ("findobj: inconsistent number of arguments"); endif - elseif (! strcmp (args{na}(1), '-')) # parameter/value pairs + elseif (! strcmp (args{na}(1), "-")) # parameter/value pairs if (na + 1 <= numel (args)) pname{np} = args{na}; na = na + 1; @@ -141,24 +141,24 @@ na = na + 1; if (na <= numel(args)) if (ischar (args{na})) - if strcmpi(args{na}, '-and') - logicaloperator{np} = 'and'; + if strcmpi(args{na}, "-and") + logicaloperator{np} = "and"; na = na+1; - elseif strcmpi(args{na}, '-or') - logicaloperator{np} = 'or'; + elseif strcmpi(args{na}, "-or") + logicaloperator{np} = "or"; na = na+1; - elseif strcmpi(args{na}, '-xor') - logicaloperator{np} = 'xor'; + elseif strcmpi(args{na}, "-xor") + logicaloperator{np} = "xor"; na = na+1; - elseif strcmpi(args{na}, '-not') - logicaloperator{np} = 'not'; + elseif strcmpi(args{na}, "-not") + logicaloperator{np} = "not"; na = na+1; endif else error ("findobj: properties and options must be strings"); endif else - logicaloperator{np} = 'and'; + logicaloperator{np} = "and"; endif np = np + 1; else @@ -166,7 +166,7 @@ endif else ## this is sloppy ... but works like matlab - if strcmpi(args{na}, '-not') + if strcmpi(args{na}, "-not") h = []; return endif @@ -185,7 +185,7 @@ while (numel (handles) && ! (idepth >= depth)) children = []; for n = 1 : numel (handles) - children = union (children, get(handles(n), 'children')); + children = union (children, get(handles(n), "children")); endfor handles = children; h = union (h, children); @@ -220,7 +220,7 @@ endif match = all (match); endif - if (strcmpi (logicaloperator{np}, 'not')) + if (strcmpi (logicaloperator{np}, "not")) keepers(nh) = ! keepers(nh) & ! match; else keepers(nh) = feval (logicaloperator{np}, keepers(nh), match); diff --git a/scripts/plot/grid.m b/scripts/plot/grid.m --- a/scripts/plot/grid.m +++ b/scripts/plot/grid.m @@ -49,11 +49,11 @@ else x = varargin{1}; if (ischar (x)) - if (strcmp ("off", x)) + if (strcmpi (x, "off")) grid_on = false; - elseif (strcmp ("on", x)) + elseif (strcmpi (x, "on")) grid_on = true; - elseif (strcmp ("minor", x)) + elseif (strcmpi (x, "minor")) minor_on = ! minor_on; if (minor_on) grid_on = true; diff --git a/scripts/plot/hidden.m b/scripts/plot/hidden.m --- a/scripts/plot/hidden.m +++ b/scripts/plot/hidden.m @@ -49,7 +49,7 @@ if (strcmp (htype, "surface")) fc = get (h, "facecolor"); if ((! ischar (fc) && is_white (fc)) - || (ischar (fc) && strcmp (fc, "none"))) + || (ischar (fc) && strcmpi (fc, "none"))) switch (mode) case "on" set (h, "facecolor", "w"); diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m --- a/scripts/plot/hold.m +++ b/scripts/plot/hold.m @@ -56,7 +56,7 @@ hold_state = get (h, "nextplot"); if (nargs == 0) - if (strcmp (hold_state, "add")) + if (strcmpi (hold_state, "add")) hold_state = "replace"; else hold_state = "add"; @@ -64,9 +64,9 @@ elseif (nargs == 1) state = varargin{1}; if (ischar (state)) - if (strcmp ("off", state)) + if (strcmpi (state, "off")) hold_state = "replace"; - elseif (strcmp ("on", state)) + elseif (strcmpi (state, "on")) hold_state = "add"; else print_usage (); diff --git a/scripts/plot/ishold.m b/scripts/plot/ishold.m --- a/scripts/plot/ishold.m +++ b/scripts/plot/ishold.m @@ -25,7 +25,7 @@ function retval = ishold () if (nargin == 0) - retval = strcmp (get (gca (), "nextplot"), "add"); + retval = strcmpi (get (gca (), "nextplot"), "add"); else print_usage (); endif diff --git a/scripts/plot/legend.m b/scripts/plot/legend.m --- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -122,7 +122,7 @@ set (ca, "key", "on"); case "toggle" val = get (ca, "key"); - if (strcmp (val, "on")) + if (strcmpi (val, "on")) set (ca, "key", "off"); else set (ca, "key", "on"); diff --git a/scripts/plot/linkprop.m b/scripts/plot/linkprop.m --- a/scripts/plot/linkprop.m +++ b/scripts/plot/linkprop.m @@ -87,7 +87,7 @@ ## However, only warn if the graphics objects aren't being deleted. warn = false; for h = hlist(:)' - if (ishandle (h) && !strcmp (get (h, "beingdeleted"), "on")) + if (ishandle (h) && !strcmpi (get (h, "beingdeleted"), "on")) warn = true; break; endif diff --git a/scripts/plot/orient.m b/scripts/plot/orient.m --- a/scripts/plot/orient.m +++ b/scripts/plot/orient.m @@ -44,7 +44,7 @@ retval = get (cf, "paperorientation"); elseif (nargin == 1) orientation = varargin{1}; - if (strcmp (orientation, "landscape") || strcmp (orientation, "portrait")) + if (strcmpi (orientation, "landscape") || strcmpi (orientation, "portrait")) set (cf, "paperorientation", orientation) else error ("orient: unknown orientation"); diff --git a/scripts/plot/plotmatrix.m b/scripts/plot/plotmatrix.m --- a/scripts/plot/plotmatrix.m +++ b/scripts/plot/plotmatrix.m @@ -102,10 +102,10 @@ for i = 1 : numel (ax) hc = ax(i); if (ishandle (hc) && strcmp (get (hc, "type"), "axes") && - strcmp (get (hc, "beingdeleted"), "off")) + strcmpi (get (hc, "beingdeleted"), "off")) parent = get (hc, "parent"); ## If the parent is invalid or being deleted, then do nothing - if (ishandle (parent) && strcmp (get (parent, "beingdeleted"), "off")) + if (ishandle (parent) && strcmpi (get (parent, "beingdeleted"), "off")) delete (hc); endif endif diff --git a/scripts/plot/shading.m b/scripts/plot/shading.m --- a/scripts/plot/shading.m +++ b/scripts/plot/shading.m @@ -59,13 +59,13 @@ for n = 1:numel(obj) h = obj(n); - if (strcmp (mode, "flat")) + if (strcmpi (mode, "flat")) set (h, "facecolor", "flat"); set (h, "edgecolor", "none"); - elseif (strcmp (mode, "interp")) + elseif (strcmpi (mode, "interp")) set (h, "facecolor", "interp"); set (h, "edgecolor", "none"); - elseif (strcmp (mode, "faceted")) + elseif (strcmpi (mode, "faceted")) set (h, "facecolor", "flat"); set (h, "edgecolor", [0 0 0]); else