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

Home » Public Forums » archive » Re: color postscript files
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: color postscript files [message #12029] Mon, 15 June 1998 00:00
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Beverly Smith wrote:
> how does one make color postscript files in IDL?
> I'm using:
>> set_plot,'ps'
>> device,/color,bits=8,/landscape,filename='test.ps'
>> plot,x,y,color=12
>> device,/close
> how do i get the standard colors like blue,red,green
> in a postscript file?

The following procedure may be useful.

;----------------------------------------------------------- ---------------
pro colors, start = start

;+
; Purpose:
; Load the sixteen McIDAS graphics colors into the current color
table.
;
; Calling Sequence:
; COLORS, START = START
;
; 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:
;
;; Display a greyscaled image using color table 0, reserving 16 colors
;; at the top of the color table. Then define the top 16 color table
;; entries, and write some colored text.
;
;window, /free, xs = 356, ys = 500
;hicolor = byte( !d.table_size - 1 - 16 )
;loadct, 0, ncolors = hicolor + 1
;tv, bytscl( dist( 256 ), top = hicolor - 1 )
;colors, start = hicolor
;magenta = hicolor + 1B
;red = hicolor + 5B
;green = hicolor + 4B
;blue = hicolor + 6B
;xyouts, 0, 300, 'Magenta', /device, color = magenta
;xyouts, 0, 350, 'Red', /device, color = red
;xyouts, 0, 400, 'Green', /device, color = green
;xyouts, 0, 450, 'Blue', /device, color = blue
;xloadct, ncolors = hicolor + 1
;
; Revised:
; 24-JULY-1996 Liam Gumley, CIMSS/SSEC
;-

;- check keywords

if n_elements( start ) eq 0 then start = 0

;- load McIDAS graphics color tables

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
;----------------------------------------------------------- ---------------
Re: color postscript files [message #12047 is a reply to message #12029] Fri, 12 June 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Beverly Smith (beverly@casa.colorado.edu) writes:

> how does one make color postscript files in IDL?

Pretty much exactly like you make color displays: by
loading and using a color table.

TVLct, [0, 255, 0], [0, 0, 255], [255, 0, 0], 1; Blue, Red, Green
data = Findgen(10)
moredata = Reverse(data)
thisDevice = !D.Name
Set_Plot, 'PS', /Copy ; Copy the color table into PS file.
Device, /Color, Bits_per_Pixel=8 ; Set up device for color output.
Plot, data, Color=3, /NoData ; Axes in green.
OPlot, data, Color=1 ; Data in blue.
OPlot, moredata, Color=2 ; More data in red.
Device, /Close
Set_Plot, thisDevice

You can find a number of articles about PostScript files
on my web page and in my IDL Programming Techniques book.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: odd behavior of loadct
Next Topic: Re: Friendly floating point slider

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

Current Time: Fri Oct 10 21:50:15 PDT 2025

Total time taken to generate the page: 0.16077 seconds