changeset 618:41c917791057

imhist: display colorbar under histogram
author carandraug
date Wed, 26 Sep 2012 09:23:26 +0000
parents 6a968d18429e
children e8b331b6a889
files NEWS inst/imhist.m
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS
+++ b/NEWS
@@ -79,7 +79,8 @@
 
  ** `imhist' is much more compatible with matlab and among other changes,
     it now uses the whole range of the class for the histogram rather than
-    the minimum and maximum of the input image.
+    the minimum and maximum of the input image and displays a colorbar under
+    the histogram.
 
  ** `isbw' now defines a black-and-white image as a binary non-sparse
     matrix. This is compatible with matlab. To use the old behaviour,
--- a/inst/imhist.m
+++ b/inst/imhist.m
@@ -145,10 +145,11 @@
     varargout{1} = nn;
     varargout{2} = bins;
   else
+    hold on;
     stem (bins, nn);
-    ## would be cool if we managed to have the colormap showed under the
-    ## histogram like matlab does. Should look into the code of waitfor and
-    ## colormap to check how to do it
+    colormap (gray (b));
+    colorbar ("SouthOutside", "xticklabel", []);
+    hold off;
   endif
 endfunction