comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: combining color tables
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: combining color tables [message #60698] Mon, 09 June 2008 23:52
jochem.verelst@gmail. is currently offline  jochem.verelst@gmail.
Messages: 19
Registered: January 2007
Junior Member
On Jun 9, 4:13 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Jun 8, 9:02 am, "jochem.vere...@gmail.com"
>
>
>
>
>
> <jochem.vere...@gmail.com> wrote:
>> Hi IDL gurus,
>
>> A color question. In an image I wish to show the values until a
>> threshold (e.g. 1) in one color gradient (e.g. red) and the values
>> from this threshold onwards into another color gradient (e.g. blue).
>
>> In the newsgroup I found the following suggestion with code to combine
>> 2 color tables. However, to me, only the color gradient of the last
>> loaded color table is  shown.
>
>> ;Why not use two different colormaps altogether...
>> im=randomu(sd,100,100)*10 ; some fake data
>> ;; Load red into upper half of color map, and blue into the lower half
>> loadct,3,BOTTOM=!D.N_COLORS/2; red
>> loadct,1,NCOLORS=!D.N_COLORS/2;blue  (only this color table is shown)
>> ;; the upper half
>> dpos=bytscl(im,MIN=1.,TOP=!D.N_COLORS/2-1)+!D.N_COLORS/2
>> ;; the lower half, in reverse!
>> dneg=!D.N_COLORS/2-1-bytscl(im,MAX=1.,TOP=!D.N_COLORS/2-1)
>> ;; Put them together
>> d=dpos*(im ge 1.)+dneg*(im lt 1.)
>> tvimage, d
>
>> Can someone help me out? I also wish to show a color bar.
>> greetzz, Jochem
>
> I think you want !D.TABLE_SIZE (the number of entries in the colour
> table) instead of !D.N_COLORS (the number of different colours
> possible in the display).
>
> -Jeremy.- Hide quoted text -
>
> - Show quoted text -

Rigth, now it works perfectly :) Thanks a lot. Also thanks for the
suggestion of checking the Brewer color tables. They are very nice.

grtzz, Jochem
Re: combining color tables [message #60709 is a reply to message #60698] Mon, 09 June 2008 07:13 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Jun 8, 9:02 am, "jochem.vere...@gmail.com"
<jochem.vere...@gmail.com> wrote:
> Hi IDL gurus,
>
> A color question. In an image I wish to show the values until a
> threshold (e.g. 1) in one color gradient (e.g. red) and the values
> from this threshold onwards into another color gradient (e.g. blue).
>
> In the newsgroup I found the following suggestion with code to combine
> 2 color tables. However, to me, only the color gradient of the last
> loaded color table is shown.
>
> ;Why not use two different colormaps altogether...
> im=randomu(sd,100,100)*10 ; some fake data
> ;; Load red into upper half of color map, and blue into the lower half
> loadct,3,BOTTOM=!D.N_COLORS/2; red
> loadct,1,NCOLORS=!D.N_COLORS/2;blue (only this color table is shown)
> ;; the upper half
> dpos=bytscl(im,MIN=1.,TOP=!D.N_COLORS/2-1)+!D.N_COLORS/2
> ;; the lower half, in reverse!
> dneg=!D.N_COLORS/2-1-bytscl(im,MAX=1.,TOP=!D.N_COLORS/2-1)
> ;; Put them together
> d=dpos*(im ge 1.)+dneg*(im lt 1.)
> tvimage, d
>
> Can someone help me out? I also wish to show a color bar.
> greetzz, Jochem

I think you want !D.TABLE_SIZE (the number of entries in the colour
table) instead of !D.N_COLORS (the number of different colours
possible in the display).

-Jeremy.
Re: combining color tables [message #60714 is a reply to message #60709] Sun, 08 June 2008 15:36 Go to previous message
russell.grew is currently offline  russell.grew
Messages: 74
Registered: February 2005
Member
You might want to check out the 'Brewer' colour tables from David
Fanning's site.

http://www.dfanning.com/programs/fsc_brewer.tbl

Open it with xloadct, file = '...fsc_brewer.tbl'

There are some nice diverging ones in there.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: using GpuLib in IDL
Next Topic: how get value from combobox

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:08:53 PDT 2025

Total time taken to generate the page: 0.01114 seconds