help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: colorbar for decimal images


From: Ben Abbott
Subject: Re: colorbar for decimal images
Date: Fri, 30 Oct 2009 14:27:41 -0400

On Oct 30, 2009, at 2:01 PM, Lorenzo Trojan <address@hidden> wrote:

On Oct 30, 2009, at 7:54 AM, Lorenzo Trojan <address@hidden>
wrote:

Hi all,

sorry for asking this question, I've been looking around but I
couldn't find a solution to this.

I have a matrix of intensities. The intensity of each pixel is a
double number ranging from e-4 to e-3 and I'd like to produce an
image using image() or imshow() and add a colorbar showing the
correct range of values. I could do something like:

minmat = min (min (matrix)) ;
maxmat = max (max (matrix)) ;
delmat = maxmat - minmat ;
imgmat = (matrix + minmat) * 64 / delmat ;
image (imgmat);
colormat (hot (64)) ;
colorbar ();

but then the colorbar would show the range from 1 to 64.

is there a way to change the labels to the colorbar so that it
display the range of the original image limits? I tried to look for
the axis object associated with the colorbar, but I could't find
them...

You can obtain the handle to the colorbar by

hc = findall (gcf, "tag", "colorbar", "type", "axes");

Or when you create the colorbar ...

hc = colorbar ();

Ben

Hi

Thanks for the reply. I downloaded findall which didn't seem to be installed on my system, from:

http://velveeta.che.wisc.edu/cgi-bin/hgwebdir.cgi/octave/file/tip//scripts/plot/findall.m?rev=HEAD&content-type=text/plain

but is didn't work. When i use it says:

warning: get: invalid property `showhiddenhandles'

and a bunch of other errors. the second solution also didn't work. Octave returns:

error: value on right hand side of assignment is undefined

I've installed octave from the main Ubuntu rep:

octave:1405> version
ans = 3.0.1

is this octave version too old?

Yes, that's too old. There may be another solution, but I don't have a copy of 3.0.x available right now to try. Anyone else?

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]