Re: Coyote Color Program Updates [message #60361 is a reply to message #60354] |
Sat, 17 May 2008 12:12   |
ph le sager
Messages: 5 Registered: June 2005
|
Junior Member |
|
|
On May 15, 11:24 am, David Fanning <n...@dfanning.com> wrote:
> Folks,
>
> I guess I was feeling ambitious, but I like those Brewer
> Colors so much, I decided to update all my color programs
> to support them. The following programs have been updated:
>
> http://www.dfanning.com/programs/fsc_color.pro
> http://www.dfanning.com/programs/xcolors.pro
> http://www.dfanning.com/programs/pickcolor.pro
> http://www.dfanning.com/programs/pickcolorname.pro
> http://www.dfanning.com/programs/ctload.pro
>
> To use Brewer Colors with with XCOLORS or CTLOAD,
> you must either download the brewer.tbl file from
> Mike Galloy's web page, or download the fsc_brewer.tbl
> file from mine. Mine contains only the 256-element color
> tables from Mike's nice file:
>
> http://www.dfanning.com/programs/fsc_brewer.tbl
>
> If you don't have a clue what I am talking about, here
> are some references:
>
> http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_in tro.html
> http://michaelgalloy.com/2007/10/30/colorbrewer.html
>
> The brewer color table file must be installed in the
> $IDL_DIR/resource/colors directory, or in the same
> directory containing the color program source code files.
> (More or less.) Other Coyote programs may also be required.
> You can download all the Coyote programs here:
>
> http://www.dfanning.com/programs/coyoteprograms.zip
>
> Or, if you never bothered to see how your IDL programming life
> could be significantly improved, you can read all about the
> programs in the Coyote Library here:
>
> http://www.dfanning.com/documents/programs.html
>
> 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.")
As I noted in a post on Mike blog (http://michaelgalloy.com/2008/02/21/
updated-brewer-color-tables.html), there is an issue with the
diverging color tables. You expect to have the "center" color (like
white or yellow) from which the color scheme diverge at index 126-127,
but :
"By plotting R,G and B vectors, I found that the diverging tables are
centered on 117. First half is index 0-116 and second half is 117-233.
They basically saturate after index 233.
So I just load the 256 colors and use only the first 233 colors."
I do not know if you fix it. But I have been using them (like you I
like them a lot), and in my program (that uses xcolors!) I used a
kludge along these lines:
xcolors, NColors=NColors, /Block, $
File=CtFile, ColorInfo=ColorInfoData, _EXTRA=e
Name = ColorInfoData.Name
Table = ColorInfoData.Index
;--------------------------------------------------------
; Temporary hack for Brewer diverging tables: they are centered on
; color #117 instead of #125. (phs, 23/4/08)
if strPos(Name, '(Diverging)') ge 0 then begin
; Reload All colors and only keep the good ones
loadct, table, file=ctfile, /SILENT
tvlct, r, g, b, /get
r = r[0:233]
g = g[0:233]
b = b[0:233]
ncolors = ncolors < 234
; compress to ncolors if needed Ncolors passed by user
if ( Is_NC_defined ) then begin
R = Congrid( R, NColors, /Minus_One, /Interp, _EXTRA=e )
G = Congrid( G, NColors, /Minus_One, /Interp, _EXTRA=e )
B = Congrid( B, NColors, /Minus_One, /Interp, _EXTRA=e )
endif
endif
;----------------- End Hack -----------------------------
This is particularly important with some values of ncolors.
Cheers, Philippe
|
|
|