From graphics-request at octave dot org Wed Aug 10 14:48:27 2005 Subject: imagesc.m scaling From: Daniel J Sebald To: octave graphics , "John W. Eaton" Date: Wed, 10 Aug 2005 14:52:47 -0500 I haven't been following the graphics set up for octave real closely. (It would be nice to have a summary or review of how things are being set up and progressing. Last I heard is that graphics was going to be put into separate modules or m-scripts associated with the plotting method used. E.g., there would be a group of m-scripts for "plot", "image", etc. for gnuplot.) Anyway, I'm looking at the imagesc.m script for 2.1.65 and I question if physically scaling the data and then using "image.m" is correct. That is, this piece of code inside imagesc.m: ## scale the limits to the range of the colormap if (maxval == minval) B = ones (size (A)); else ## Rescale values to between 1 and length (colormap) inclusive. B = round ((A - minval) / (maxval - minval) * (rows (colormap) - 1)) + 1; endif The problem with the above is that when used in gnuplot and the colorbox is active, the range on the colorbox makes no sense with regard to the original data. (Some may argue that color boxes aren't supported... but I'd like one.) What I see as the only difference between image.m and imagesc.m is that the "cbrange" (gnuplot's term) is different. In the case of image.m, it is from 0 to N-1 where N is the size of the palette. In the case of imagesc.m, it is from the min of the data to the max of the data (or [Hi:Lo] if specified). Since Octave's gnuplot image support isn't far enough along yet, the following would be for my own setup. But I'd propose the following layout __image__.m: Similar to the modified-for-gnuplot-with-image image.m I created as it currently stands. image.m: Set cbrange to 0 to N-1, call __image__.m imagesc.m: Set cbrange to min:max or HI:LO, call __image__.m Any thoughts for those who might be working on gnuplot support? Dan