fun with nonlinearity and COLORBAR [message #72965] |
Thu, 21 October 2010 12:20  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
I'm looking for advice on a plot I'm making that uses David's COLORBAR
routine. The problem is that the mapping between color index in the
image and data value is quite non-linear - and not a simple
transformation, either (it's generated via histogram equalization).
There are a few ways I can imagine having it look. So first, from an
aesthetics (and ease-of-understanding) standpoint, which would be
best?
1. The colorbar has one line for each color index, and is annotated
using 6 evenly-spaced divisions, but the numbers marking those
divisions are not evenly distributed.
2. The colorbar has one line for each color index, the annotations
are evenly spaced in *value*, but are spaced unevenly along the color
bar.
3. The colorbar is annotated using 6 evenly-spaced divisions that
have evenly-spaced numbers, and the colors within the color bar vary
(i.e. the mapping between row up the color bar and color index is no
longer linear).
The second question is implementation. I can achieve #1 very easily
using COLORBAR. I think that in order to do #2, I would need to
essentially roll my own version of COLORBAR that changes the
annotation locations - are there any shortcuts that would let me use
the existing routine? To do #3, my best idea is to regenerate a new
(non-linearly altered) color table, and then use the existing COLORBAR
routine. Any caveats with that, or any easier ways to do it?
Alternatively, what other ideas do people have for conveying this kind
of information?
-Jeremy.
|
|
|
Re: fun with nonlinearity and COLORBAR [message #73083 is a reply to message #72965] |
Fri, 22 October 2010 07:37  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Oct 21, 10:34 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Oct 21, 3:35 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> Jeremy Bailin writes:
>>> I'm looking for advice on a plot I'm making that uses David's COLORBAR
>>> routine. The problem is that the mapping between color index in the
>>> image and data value is quite non-linear - and not a simple
>>> transformation, either (it's generated via histogram equalization).
>
>>> There are a few ways I can imagine having it look. So first, from an
>>> aesthetics (and ease-of-understanding) standpoint, which would be
>>> best?
>>> 1. The colorbar has one line for each color index, and is annotated
>>> using 6 evenly-spaced divisions, but the numbers marking those
>>> divisions are not evenly distributed.
>>> 2. The colorbar has one line for each color index, the annotations
>>> are evenly spaced in *value*, but are spaced unevenly along the color
>>> bar.
>>> 3. The colorbar is annotated using 6 evenly-spaced divisions that
>>> have evenly-spaced numbers, and the colors within the color bar vary
>>> (i.e. the mapping between row up the color bar and color index is no
>>> longer linear).
>
>>> The second question is implementation. I can achieve #1 very easily
>>> using COLORBAR. I think that in order to do #2, I would need to
>>> essentially roll my own version of COLORBAR that changes the
>>> annotation locations - are there any shortcuts that would let me use
>>> the existing routine? To do #3, my best idea is to regenerate a new
>>> (non-linearly altered) color table, and then use the existing COLORBAR
>>> routine. Any caveats with that, or any easier ways to do it?
>
>>> Alternatively, what other ideas do people have for conveying this kind
>>> of information?
>
>> If you are talking about six discrete colors, I would use
>> the discrete color bar, DCBAR.
>
>> I have implemented something like number 1, equally spaced
>> divisions, with non-linear values, using FSC_Colorbar (new
>> name!) in this article:
>
>> http://www.dfanning.com/map_tips/precipmap.html
>
>> I had to use a tick formatting function to do it correctly.
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> Ah yes, FSC_COLORBAR. ;-) I haven't switched to 8.0 yet, so I'm still
> safe from that issue for now...
>
> It's a continuous color bar (basically color table 4 with a slight
> modification). I've got a feeling that #3 is the aesthetically-correct
> thing to do. Not coincidentally, it's probably the one that requires
> the most work. Ah well...
Well, to get a quick idea of the possibility download
http://hea-www.cfa.harvard.edu/~pgrigis/idl_stuff/pg_plotima ge.pro
and try this:
;set up colorbar
loadct,5
x=[[findgen(256)],[findgen(256)]]
;plot colorbar
;uniform ticks, uniform colors
pg_plotimage,x
;uniform ticks, stretched colors
pg_plotimage,alog(x+1)
;weird ticks
pg_plotimage,x,xtickv=[10,100,120,150,220],xticks=4,/xst
;logscaling
pg_plotimage,alog(x+1),/xlog,/xst
Have fun exploring - hopefully you'll be able to find a good
rerpresentation
for your purpose (and when you do you can use more proper tools then
my image plotter).
Ciao,
Paolo
>
> -Jeremy.
|
|
|