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

Home » Public Forums » archive » 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
Color tables [message #17997] Mon, 22 November 1999 00:00 Go to next message
Karsten Thiel is currently offline  Karsten Thiel
Messages: 1
Registered: November 1999
Junior Member
Hi everybody!
I'm facing a problem concerning the color tables. I would like to
display a large array with some negativ
values. Till now I'm doing this with TVSCL, but the information where
the values are negativ is very important for me. So how are the
pre-defined color tables defined? Which table is the best for my
problem?
Somebody's got an idea?
Thanx i. a.

Karsten Thiel
Re: Color tables [message #18062 is a reply to message #17997] Tue, 23 November 1999 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
J.D. Smith (jdsmith@astro.cornell.edu) writes:

> Why not use two different colormaps altogether...

I didn't think he was *quite* ready for the whole shebang,
but it's good advice and *exactly* what I would have
really done. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Color tables [message #18066 is a reply to message #17997] Tue, 23 November 1999 00:00 Go to previous messageGo to next message
J.D. Smith is currently offline  J.D. Smith
Messages: 214
Registered: August 1996
Senior Member
David Fanning wrote:
>
> Karsten Thiel (thiel@ph4.physik.uni-goettingen.de) writes:
>
>> I'm facing a problem concerning the color tables. I would like to
>> display a large array with some negativ
>> values. Till now I'm doing this with TVSCL, but the information where
>> the values are negativ is very important for me. So how are the
>> pre-defined color tables defined? Which table is the best for my
>> problem?
>
> Well, Karsten, I hate to tell you, but NONE of the color
> tables are best for your problem. And, in fact, if
> colors *are* important to you (and they must be or you wouldn't
> be writing) then you had better ditch TVSCL too. :-)
>
> Let me give you an example. Suppose you have data in
> a variable named "array". And suppose you would like to
> see the positive values of the data in the Red Temperature
> color table. But you would like to see the negative values
> of your data in a yellow color.
>
> Then you could do something like this. Let's suppose
> you have 200 colors to use. Let's use 199 of them
> for the Red Temperature color scale:
>
> LoadCT, 3, NColors=199
>
> Let's make the 200th color yellow:
>
> TVLCT, 255, 255, 0, 199
>
> Now, lets scale the data so that the positive
> values lie in the data range 0 to 198. In other
> words, they will be displayed in the Red Temperature
> colors:
>
> scaledData = BytScl(array, Min=0, Top=198)
>
> Let's find out where our negative values are:
>
> negvalues = Where( array LT 0, count)
>
> Make the negative values yellow:
>
> IF count GT 0 THEN scaledData[negvalues] = 199B
>
> Now, have a look! :-)
>
> TV, scaledData
>
> It is always better to have some *plan* for using colors
> than to just take whatever IDL seems to offer.
>


Why not use two different colormaps altogether...

im=randomu(sd,100,100)-.2 ; some fake data

;; Load red into upper half of color map, and blue into the lower half
loadct,3,BOTTOM=!D.N_COLORS/2 & loadct,1,NCOLORS=!D.N_COLORS/2

;; Scale all positives into the upper half
dpos=bytscl(im,MIN=0.,TOP=!D.N_COLORS/2-1)+!D.N_COLORS/2
;; Scale all negatives into the lower half, in reverse!
dneg=!D.N_COLORS/2-1-bytscl(im,MAX=0.,TOP=!D.N_COLORS/2-1)
;; Put them together
d=dpos*(im ge 0.)+dneg*(im lt 0.)

I've loaded red into the top half, blue into the bottom half. The positives are
scaled into the top half, and the negatives are scaled in reverse into the
bottom half (so that more negative values would be brighter blue). Obviously
there are many different possibilities based on this basic scheme. You can also
create your own custom colormap, but often it's easiest to scale the data
instead.

Good luck,

JD

--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
Re: Color tables [message #29573 is a reply to message #17997] Thu, 07 March 2002 05:28 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Clive Cook wrote:
>
> Is there any where on the web i can download color table files that other
> people have put together?
>
> cheers
> Clive

Yes
and you can define your own with our x_def_colortable


http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/x_def_colortable.tar.gz

http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/ct_blue_green.tar.gz
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/ct_blue_green_yellow_red.tar.gz
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/ct_blue_red.tar.gz


ten more are available at our library:

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

regards
Reimar

--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
Re: Color tables [message #29719 is a reply to message #17997] Thu, 07 March 2002 07:05 Go to previous message
Ken Mankoff is currently offline  Ken Mankoff
Messages: 158
Registered: February 2000
Senior Member
On Thu, 7 Mar 2002, Robert Stockwell wrote:

> Clive Cook wrote:
>> Is there any where on the web i can download color table files that other
>> people have put together?

Here is my colortable production code:
Note that if you call it with the /DISPLAY keyword, you need the JHU
cbar.pro program


pro snoect, display=display
; RED GRN BLU LOC
rgb = [ [ 000, 000, 000, 000 ], $ ; first pixel (0) is black
[ 000, 000, 255, 001 ], $ ; blue (true)
[ 000, 150, 255, 032 ], $ ; mid blue
[ 000, 220, 220, 060 ], $ ; blue/green
[ 000, 255, 000, 110 ], $ ; green (true)
[ 150, 255, 000, 120 ], $ ; lime green
[ 255, 255, 000, 150 ], $ ; yellow
[ 255, 220, 000, 180 ], $ ; gold
[ 255, 150, 000, 225 ], $ ; orange
[ 255, 000, 000, 254 ], $ ; red (true)
[ 255, 255, 255, 255 ] ] ; last pixel (255) is white

r = interpol( rgb[ 0, * ], rgb[3,*], indgen(256) ) >0<255
g = interpol( rgb[ 1, * ], rgb[3,*], indgen(256) ) >0<255
b = interpol( rgb[ 2, * ], rgb[3,*], indgen(256) ) >0<255
tvlct, r, g, b

if ( keyword_set( display ) ) then begin
IF ( !d.name EQ 'X' ) THEN window, 2
plot, rgb[3,*], rgb[0,*], /xst, position=[.1,.3,.9,.9], $
/yst, yrange=[0,256], $
xtickv=indgen(9)*32, xticks=10, charsize=1.5
oplot, rgb[3,*], rgb[0,*], color=254, thick=3, psym=-6
oplot, rgb[3,*], rgb[1,*], color=110, thick=3, psym=-6
oplot, rgb[3,*], rgb[2,*], color=40, thick=3, psym=-6
cbar, position=[.1,.1,.9,.2], /xst, xtickv=indgen(9)*32, xticks=10
endif
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Color tables
Next Topic: un-Mask?/PolyOutlineV?

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

Current Time: Wed Oct 08 18:38:21 PDT 2025

Total time taken to generate the page: 0.00759 seconds