Re: Teaching an Elephant to Dance [message #77574 is a reply to message #77567] |
Tue, 13 September 2011 08:53   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
>
> Mark Piper writes:
>
>> cb = colorbar(target=c, $
>> tickname=string(levels, format='(f4.2)'), $ ; use the levels
>> position=[0.1, 0.90, 0.9, 0.95])
>
> Even though I can't run this code because of the TICKNAME
> keyword that crashes my machine, I can see that this is
> only a cosmetic fix, not a real fix. The color bar
> is actually showing data that runs from 0.0134 to
> 0.9847, and it is dividing that range into four divisions.
> But, the divisions do not fall where we need them to fall.
> The divisions are marked at 0.2563, 0.4991, and 0.7419.
> This is so even if you *label* them 0.25, 0.50, and 0.75!
>
> If we weren't so lucky with our actual data range, we
> would see BIG differences in how the tick marks on the
> color bar and the colors themselves line up.
>
> Run this program with data defined like this, and you
> will see what I mean:
>
> data = 0.125 > Randomu(-3L,9,9) < 0.875
I think I am beginning to understand the philosophy
behind the Colorbar() function.
A color bar is not actually related to anything in the
physical world. It doesn't have anything to do, for
example, with the levels with which you fill a contour
plot, etc. In function graphics, the colorbar is *only*
associated with some specific "data". That is, the
data of a contour plot or the data of an image.
The data seldom has a direct one-to-one connection to
the range of data you want to represent in a color
bar, so I think the idea is "Why worry about it?"
The color bar simply labels itself according to the
"data" it is associated with. If that is not what
you want, change it with the TICKNAME keyword.
This, of course, puts the burden (rightly, probably)
on you to format the tick names the way you want
them to be formatted.
For me, of course, this is a big problem, because
the TICKNAME keyword crashes my machine every single
&*$%#*& time! But, maybe it doesn't crash other people's
machines and this is the way the color bar is suppose
to work.
I can see the point, I just can't see how that makes
the Colorbar() function easy to use. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|