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

Home » Public Forums » archive » color table
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Color table [message #58176 is a reply to message #8601] Mon, 21 January 2008 07:09 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
WRC2008@gmail.com writes:

> me....again...
>
> Everything works out fine for the blue-white-red, even the background
> color and axis colors, as the colortable.
>
> BUT, I am also working with the blue-red color table, defined as
> follows:
>
>
> steps = 256
> scaleFactor = FINDGEN(steps) / (steps - 1)
> ;color scheme by Fanning to go from blue to red
> tvlct,red,green,blue,/get
> ;Red vector: 0 -> 255
> red = 0 + (255 - 0) * scaleFactor
> ; Green vector: 0 -> 0
> green= REPLICATE(0, steps)
> ; Blue vector: 255 -> 0
> blue = 255 + (0 - 255) * scaleFactor
> TVLCT, red, green, blue
> DEVICE, RETAIN=2, DECOMPOSED=0
> Window, Xsize=steps,Ysize=40, Title='Color Table'
> TV, bindgen(steps) # replicate(1B,40)
>
>
>
> This is also working, fine, but again, my background went to blue, as
> do all the symbols, axes and text in the plot. I would like to change
> background (outside of the plot, but in the window) into white, and
> the rest in black. How can this be done? Just changing to another
> colorvalue e.g. 0 to 255, of course doesn't change with this blue-red
> color table...

The best way to avoid changing the background and foreground
colors is to, well, avoid changing them. :-)

They are located at the top and the bottom of the color table.
(Another good reason not to change them is that if you don't your
PostScript output has a fairly good chance of looking like your
display output.)

Try something like this:

steps = 254
scaleFactor = FINDGEN(steps) / (steps - 1)
;color scheme by Fanning to go from blue to red
tvlct,red,green,blue,/get
;Red vector: 0 -> 255
red = 0 + (255 - 0) * scaleFactor
; Green vector: 0 -> 0
green= REPLICATE(0, steps)
; Blue vector: 255 -> 0
blue = 255 + (0 - 255) * scaleFactor
Loadct, 0, /Silent
TVLCT, red, green, blue, 1
DEVICE, RETAIN=2, DECOMPOSED=0
Window, Xsize=steps,Ysize=40, Title='Color Table'
TV, BytScl(bindgen(steps) # replicate(1B,40), Top=253) + 1B
window, 1
plot, findgen(11)

If you have the CINDEX program, you can have a look at
how your color table looks:

IDL> CIndex

You can find the program here:

http://www.dfanning.com/programs/cindex.pro

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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Plotting a compass
Next Topic: Using self reference in WHERE statement?

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

Current Time: Wed Oct 08 19:59:55 PDT 2025

Total time taken to generate the page: 0.00485 seconds