Re: imagesc.m scaling
Daniel J Sebald <[email protected]> Wed, 10 Aug 2005 23:52:53 -0500
| Newsgroups | gmane.comp.gnu.octave.graphics |
|---|---|
| Message-ID | <[email protected]> |
For anyone interested, attached is a zip file of gnuplot image related code. Put the files in a path and create links, i.e., ln -s image_gp.m image.m ln -s imagesc_gp.m imagesc.m ln -s imshow_gp.m imshow.m The imagesc.m function properly creates a colorbox matching the data values. Dan Daniel J Sebald wrote: > 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 > -- Dan Sebald phone: 608 256 7718 email: daniel DOT sebald AT ieee DOT org URL: http://acer-access DOT com/~dsebald AT acer-access DOT com/
gp_image.zip
(application/zip, 7.8 KB) - not displayed