# HG changeset patch # User Pantxo Diribarne # Date 1365249381 -7200 # Node ID 64ad713b3a644ba4ad957ba26ed0a40d589c5c91 # Parent 8ad59bef27b57c894490b09957cd912c1c568720 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive * scripts/image/imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive. diff -r 8ad59bef27b5 -r 64ad713b3a64 scripts/image/imshow.m --- a/scripts/image/imshow.m Tue Oct 22 19:39:50 2013 -0400 +++ b/scripts/image/imshow.m Sat Apr 06 13:56:21 2013 +0200 @@ -45,6 +45,19 @@ ## @table @asis ## @item @qcode{"displayrange"} ## @var{value1} is the display range as described above. +## +## @item "xdata" +## If @var{value1} is a two element vector, it must contain horizontal axis +## limits in the form [xmin xmax]; Otherwise @var{value1} must be a +## vector and only the first and last elements will be used for xmin and +## xmax respectively. +## +## @item "ydata" +## If @var{value1} is a two element vector, it must contain vertical axis +## limits in the form [ymin ymax]; Otherwise @var{value1} must be a +## vector and only the first and last elements will be used for ymin and +## ymax respectively. +## ## @end table ## ## The optional return value @var{h} is a graphics handle to the image. @@ -64,6 +77,7 @@ display_range = NA; true_color = false; indexed = false; + xdata = ydata = []; ## Get the image. if (ischar (im)) @@ -105,9 +119,21 @@ error ("imshow: argument number %d is invalid", narg+1); endif elseif (ischar (arg)) - switch (arg) + switch (tolower (arg)) case "displayrange"; display_range = varargin{narg++}; + case "xdata"; + xdata = varargin{narg++}; + if (! isvector (xdata)) + error ("imshow: xdata must be a vector") + endif + xdata = [xdata(1) xdata(end)]; + case "ydata"; + ydata = varargin{narg++}; + if (isvector (xdata)) + error ("imshow: expect a vector for ydata") + endif + ydata = [ydata(1) ydata(end)]; case {"truesize", "initialmagnification"} warning ("image: zoom argument ignored -- use GUI features"); otherwise @@ -161,9 +187,9 @@ endif if (true_color || indexed) - tmp = image ([], [], im); + tmp = image (xdata, ydata, im); else - tmp = image (im); + tmp = image (xdata, ydata, im); set (tmp, "cdatamapping", "scaled"); ## The backend is responsible for scaling to clim if necessary. set (gca (), "clim", display_range);