Re: color and tvellipse [message #75625] |
Tue, 15 March 2011 16:21 |
Gray
Messages: 253 Registered: February 2010
|
Senior Member |
|
|
On Mar 15, 5:29 pm, David Fanning <n...@idlcoyote.com> wrote:
> Gray writes:
>> So cgColor can accept indices to the color table? Coooooool
>
> cgColor is the key to the whole glorious chest of jewels. :-)
>
> By the way, books should be here by the end of the week.
> Only a few more days of the pre-publication sale!
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
That did it. Amazing!
|
|
|
Re: color and tvellipse [message #75627 is a reply to message #75625] |
Tue, 15 March 2011 14:29  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Gray writes:
> So cgColor can accept indices to the color table? Coooooool
cgColor is the key to the whole glorious chest of jewels. :-)
By the way, books should be here by the end of the week.
Only a few more days of the pre-publication sale!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: color and tvellipse [message #75629 is a reply to message #75627] |
Tue, 15 March 2011 14:16  |
Gray
Messages: 253 Registered: February 2010
|
Senior Member |
|
|
On Mar 15, 5:10 pm, David Fanning <n...@idlcoyote.com> wrote:
> Gray writes:
>> I want to draw a number of ellipses with TVEllipse, and have the color
>> of each ellipse correspond to one of the colors in a discrete
>> colorbar. I'm using CG, so I created the plot with cgPlot, /nodata...
>> then I loaded the color table with cgLoadCT, and created the colorbar
>> with cgDCBar. However, when I try to use the color indices with
>> TVEllipse, they all are plotted in black. Any suggestions?
>
>> Here's my code:
>
>> cgplot, indgen(3), /nodata, xra=[x0,x1], yra=[y0,y1],$
>> xst=1, yst=1, charsize=1.25, xtitle='Right Ascension (hours)', $
>> ytitle='Declination (hours)', title='Survey Extent', $
>> position=[0.1,0.1,0.85,0.9]
>> for i=0,nd-1 do $
>> cgplots, ra[*,i], dec[*,i]
>> for i=0,nr-1 do $
>> cgplots, ra[i,*], dec[i,*]
>> cgloadct, 25, /brewer, ncolors=12, bottom=1
>> cgdcbar, ncolors=12, bottom=1, color='navy', $
>> labels=themonths(/abbrev),/vertical
>> for i=0,nday-1,10 do tvellipse,3,45,ra0[i],dec0[i],0,months[i],/data
>
> I guess "months[i]" must be the "color". I don't
> know what is in there, but if it is a number, I
> would make it a color like this:
>
> color = cgColor(StrTrim(months[i],2))
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
So cgColor can accept indices to the color table? Coooooool. And
yes, "months[i]" is a number from 1 to 12 (as you might expect), which
should index the color table that I loaded with 12 colors :) I'll try
that.
|
|
|
Re: color and tvellipse [message #75630 is a reply to message #75629] |
Tue, 15 March 2011 14:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Gray writes:
> I want to draw a number of ellipses with TVEllipse, and have the color
> of each ellipse correspond to one of the colors in a discrete
> colorbar. I'm using CG, so I created the plot with cgPlot, /nodata...
> then I loaded the color table with cgLoadCT, and created the colorbar
> with cgDCBar. However, when I try to use the color indices with
> TVEllipse, they all are plotted in black. Any suggestions?
>
> Here's my code:
>
> cgplot, indgen(3), /nodata, xra=[x0,x1], yra=[y0,y1],$
> xst=1, yst=1, charsize=1.25, xtitle='Right Ascension (hours)', $
> ytitle='Declination (hours)', title='Survey Extent', $
> position=[0.1,0.1,0.85,0.9]
> for i=0,nd-1 do $
> cgplots, ra[*,i], dec[*,i]
> for i=0,nr-1 do $
> cgplots, ra[i,*], dec[i,*]
> cgloadct, 25, /brewer, ncolors=12, bottom=1
> cgdcbar, ncolors=12, bottom=1, color='navy', $
> labels=themonths(/abbrev),/vertical
> for i=0,nday-1,10 do tvellipse,3,45,ra0[i],dec0[i],0,months[i],/data
I guess "months[i]" must be the "color". I don't
know what is in there, but if it is a number, I
would make it a color like this:
color = cgColor(StrTrim(months[i],2))
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|