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

Home » Public Forums » archive » Re: How to load a customized 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: How to load a customized color table? [message #64627 is a reply to message #64626] Mon, 12 January 2009 10:51 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Spon writes:

> On Jan 12, 9:26=A0am, RussellGrew <russell.g...@gmail.com> wrote:
>> g[*] =3D 0.
>>
>> may be more appropriate.
>
> Also completely unnecessary, as IDL will set all elements of a newly
> created array to 0 by default unless you use the /NoZero keyword. I'm
> also not sure what that common block is doing there, or the double
> precision numbers that get turned into bytes anyway.
>
> This is how I'd write such a procedure:
>
> ***
>
> ; OldRGB is an output variable that
> ; returns the previous colour table values
> PRO LOADREDBLUE, OldRGB
> ; Store current colour table
> TVLCT, OldRGB, /GET
> ; Generate new colour table values
> R =3D [2B*REVERSE(BINDGEN(128)), BYTARR(128)]
> G =3D BYTARR(256)
> B =3D [BYTARR(128), 2B*BINDGEN(128)]
> ; And load them
> TVLCT, R, G, B
> PRINT, 'Loading table: Red-Black-Blue'
> RETURN
> END
>
> ***
>
> So if you cared about turning your old colour table back on after your
> call, you could use the procedure like in this example:
> IDL> Device, Decomposed =3D 0
> IDL> Image =3D Dist(256)
> IDL> LOADREDBLUE, Previous ; load your custom table. The 'Previous'
> variable contains the old table's values.
> IDL> TVSCL, Image ; display the image
> IDL> TVLCT, Previous ; reload the old table
> IDL> Window, /Free & Plot, Image ; using previous colour table in a
> new window
>
> And if you don't care what the previous colour table looked like, just
> type:
> IDL> LOADREDBLUE
> and you're away (assuming that, again, you've turned off decomposed
> colours)
> IDL> TV, Bindgen(256,256)

Yeah, I'd do it like this:

IDL> CTLoad, 22, /Brewer

Of course, that goes through white rather than black, but
that's better for the...uh, old folks who might be looking
at your plot. :-)

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
Previous Topic: how to use wavelet transformation function in IDL?
Next Topic: Re: Solve memory problems

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

Current Time: Fri Oct 10 05:43:46 PDT 2025

Total time taken to generate the page: 0.47908 seconds