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

Home » Public Forums » archive » Re: problem with color graph with idl 5.0 Win95 version
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: problem with color graph with idl 5.0 Win95 version [message #14189] Tue, 02 February 1999 00:00
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
vincent wrote:
> I need to make a graph which contains more different plots inside. I
> have used the commands plot and oplot with the keywords Color but i have
> no what i want. The result is indeed the graph i need but every line is
> showed in a grey level rather then in a color way.

Give this a go:

;---cut here---
PRO COLORS, START = START

;+
; Purpose:
; Load the sixteen McIDAS graphics colors into the current color
table.
;
; Usage:
; COLORS
;
; Input:
; None
;
; Output:
; None
;
; Optional Keywords:
; START Start index in the color table where the McIDAS graphics
; colors will be loaded (default = 0).
;
; Notes:
; The color table assignments are as follows
; 0 => black
; 1 => magenta
; 2 => cyan
; 3 => yellow
; 4 => green
; 5 => red
; 6 => blue
; 7 => white
; 8 => navy
; 9 => gold
; 10 => pink
; 11 => aquamarine
; 12 => orchid
; 13 => gray
; 14 => sky
; 15 => beige
;
; Example:
;colors
;xyouts, 0, 0, 'Magenta', /device, color=1
;xyouts, 0, 100, 'Red', /device, color=5
;xyouts, 0, 200, 'Green', /device, color=4
;xyouts, 0, 300, 'Blue', /device, color=6
;
; Author:
; Liam.Gumley@ssec.wisc.edu
;-

;- Check keywords

if n_elements( start ) ne 1 then start = 0

;- Load McIDAS graphics colors

r = [0,255,0,255,0,255,0,255,0,255,255,112,219,127,0,255]
g = [0,0,255,255,255,0,0,255,0,187,127,219,112,127,163,171]
b = [0,255,255,0,0,0,255,255,115,0,127,147,219,127,255,127]
tvlct, r, g, b, start

END
;---cut here---

Note: If you want Postscript output, don't forget to do the following:

SET_PLOT, 'PS'
DEVICE, /COLOR, BITS=8, ...

Cheers,
Liam.

---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
1225 W. Dayton St., Madison WI 53706, USA
Phone (608) 265-5358, Fax (608) 262-5974
http://cimss.ssec.wisc.edu/~gumley
Re: problem with color graph with idl 5.0 Win95 version [message #14197 is a reply to message #14189] Tue, 02 February 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Vincent (corona@ba.infn.it) writes:

> thanks for your reply, but i have to use more colors than 3 !
> Maybe, should i define other vectors as "a,b,c", i.e. one for every
> color i need ?

You can load as many colors as you need, or you can load any
one of the 41 color tables that comes with IDL. If you load
color tables (XLOADCT or LOADCT, for example), you may want
to know what color is associated with which index. The program
CINDEX from my anonymous ftp site is useful for this purpose:

ftp://ftp.dfanning.com/pub/dfanning/outgoing/misc/cindex.pro

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155

[Note: This follow-up was e-mailed to the cited author.]
Re: problem with color graph with idl 5.0 Win95 version [message #14198 is a reply to message #14189] Tue, 02 February 1999 00:00 Go to previous message
vincent is currently offline  vincent
Messages: 4
Registered: February 1999
Junior Member
David Fanning wrote:
>
> Vincent (corona@ba.infn.it) writes:
>
>> hi ;) i'm a newbie of this very interesting language.
>> I use the 5.0 version of IDL for Windows95, and i have this problem.
>>
>> I need to make a graph which contains more different plots inside. I
>> have used the commands plot and oplot with the keywords Color but i have
>> no what i want. The result is indeed the graph i need but every line is
>> showed in a grey level rather then in a color way.
>> Here is a little prg i have written for testing the graphic capabilities
>> of IDL.
>>
>> Could someone help and show me where i make mistakes ?
>
> You need to create some colors to draw with and then
> load them. If you don't, IDL's default color table is
> always grayscale. Something along these lines:
>
> ; Load red, green, and yellow colors starting at index 200.
> ; Read the color triples vertically.
>
> r = [255, 0, 255]
> g = [ 0, 255, 255]
> b = [ 0, 0, 0]
> TVLCT, r, g, b, 200
>
> ; Draw plots in colors.
>
> Plot, data, Color=200
> Oplot, moredata, Color=201
> Oplot, stillmoredata, Color=202

thanks for your reply, but i have to use more colors than 3 !
Maybe, should i define other vectors as "a,b,c", i.e. one for every
color i need ?

>
> There are quite a few articles about using color in IDL on
> my web page in the Programming Tips section:
>
> http://www.dfanning.com/documents/tips.html
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155

regards

Vince

p.s.: congratulations for your great web page ;)
Re: problem with color graph with idl 5.0 Win95 version [message #14200 is a reply to message #14189] Tue, 02 February 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Vincent (corona@ba.infn.it) writes:

> hi ;) i'm a newbie of this very interesting language.
> I use the 5.0 version of IDL for Windows95, and i have this problem.
>
> I need to make a graph which contains more different plots inside. I
> have used the commands plot and oplot with the keywords Color but i have
> no what i want. The result is indeed the graph i need but every line is
> showed in a grey level rather then in a color way.
> Here is a little prg i have written for testing the graphic capabilities
> of IDL.
>
> Could someone help and show me where i make mistakes ?

You need to create some colors to draw with and then
load them. If you don't, IDL's default color table is
always grayscale. Something along these lines:

; Load red, green, and yellow colors starting at index 200.
; Read the color triples vertically.

r = [255, 0, 255]
g = [ 0, 255, 255]
b = [ 0, 0, 0]
TVLCT, r, g, b, 200

; Draw plots in colors.

Plot, data, Color=200
Oplot, moredata, Color=201
Oplot, stillmoredata, Color=202

There are quite a few articles about using color in IDL on
my web page in the Programming Tips section:

http://www.dfanning.com/documents/tips.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Map spanning Dateline?
Next Topic: !P.MULTI + POSITION keyword problem

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

Current Time: Wed Oct 08 18:13:48 PDT 2025

Total time taken to generate the page: 0.00754 seconds