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 #81901 is a reply to message #8601] Sat, 10 November 2012 17:38 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gompie writes:

> I have a single variable spread over three years. I wish to give a
different color to each year.
>
> But instead of color I get grey scale. I have the following script.
>
>
> cgLoadCT, 4, NCOLORS=3, CLIP=[16,240]
> bplate=fltarr(18)
> name=strarr(18)
> mont=fltarr(19)
> years=fltarr(19)
> ffiles = FILE_SEARCH('*.txt1')
> for index=0,n_elements( ffiles)-1 do begin
> year=(strsplit(ffiles(index),'.,_',/extract))[0]
> month=(strsplit(ffiles(index),'.,_',/extract))[1]
> name(index)=string(month)
> years(index) = float(year)
> OPENR, lun, ffiles(index), /GET_LUN
> temp=0.0D
> i=0L
> data=strarr(1)
> print,ffiles(index)
> WHILE ~ EOF(lun) DO BEGIN
> readf,lun,data
> temp=float(data) + temp
> i=i+1
> ;print,i,float(data),data
> ENDWHILE
> print,temp/i
> bplate(index)=temp/i
> mont(index)=index
> close,lun
> free_lun,lun
> endfor
>
> colors = Scale_Vector(Findgen(3), 2009, 2011)
>
> elevColors = Value_Locate(colors,years )
> elevColors = StrTrim(Round(Scale_Vector(elevColors, 0, 10)),2)
>
> !X.TICKNAME=name
>
> cgplot,mont,bplate,psym=4,thick=2,xticks=17,yrange=[260,270] ,xtitle='MONTHS',ytitle='MIN_0_87_MICRON_DETECTOR_TEMP',BACK GROUND = 255, COLOR = 0
> FOR j=0,n_elements(mont)-2 DO cgPlotS, mont[j], bplate[j], Color=elevColors[j], Thick=2,psym=sym(5),symsize = 1.15
> fname="bplate.gif"
> result = cgSnapshot(FILENAME=fname,/gif ,/nodialog)

Uh, well, I think I would just do something like this:

elevColors = ['red', 'green', 'blue']

> Question .2 . Is it possible to view the exact colors Vs color number that are finally loaded by the color table.

Try CIndex:

IDL> cindex

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("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: Fri Oct 10 12:42:55 PDT 2025

Total time taken to generate the page: 0.95960 seconds