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

Home » Public Forums » archive » Re: Using Postscript & Colours in IDL
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: Using Postscript & Colours in IDL [message #58414 is a reply to message #58324] Mon, 28 January 2008 08:11 Go to previous messageGo to previous message
liamgumley is currently offline  liamgumley
Messages: 74
Registered: June 2005
Member
On Jan 28, 9:10 am, chloesharro...@gmail.com wrote:
> Sorry, I know I'm being really slow/annoying, but I'm still completely
> lost! I have tried using Liam Gumley's book (I have it in front of me
> as I type), but am still completely lost with using colours in
> postscript output (I can't follow his examples because I don't
> understand the basics - I don't know the difference between an 8-bit
> mode or 24-bit display etc.

Chloé,

I agree that graphics in IDL can be a bit confusing. Here's a simple
example, based on the LOADCOLORS (p. 249), PSON (p. 362), and PSOFF
(p. 366) sample programs from my book. First, download and unzip the
sample program zip file (PIP_programs.zip) from

http://gumley.com/PIP/About_Book.html

Start a new IDL session, and then change to the directory where you
unzipped the sample programs, e.g.,

IDL> cd, '/home/chloe/PIP_programs'

Then try this example program which first renders a multi-color plot
onscreen, and then sends the same plot to a PostScript output file
named test.ps.

;===
PRO TEST_PLOT

x = [0, 1, 2, 3, 4]
y = [0, 2, 4, 6, 8]

;- Create the plot onscreen
loadcolors
plot, x, y, title='My Test Plot', background=7, color=0, /nodata
oplot, x, y * 1.00, psym=4, symsize=2, color=4
oplot, x, y * 0.50, psym=5, symsize=2, color=5
oplot, x, y * 0.25, psym=6, symsize=2, color=6

;- Repeat the plot to PostScript output
loadcolors
pson, filename='test.ps'
plot, x, y, title='My Test Plot', background=7, color=0, /nodata
oplot, x, y * 1.00, psym=4, symsize=2, color=4
oplot, x, y * 0.50, psym=5, symsize=2, color=5
oplot, x, y * 0.25, psym=6, symsize=2, color=6
psoff

END
;===

Note that the PSON and PSOFF routines make it easy to switch on and
switch off the PostScript device. If you want to add the sample
program directory to your IDL path so that PSON and PSOFF are always
available, regardless of which directory you are in when you start
IDL, then create an IDL startup file as explained on p. 204. My IDL
startup file looks like this:

if !version.os_family eq 'unix' then device, true_color=24
window, /free, /pixmap, colors=-10
wdelete, !d.window
device, decomposed=0, retain=2, set_character_size=[10, 12]
device, get_visual_depth=depth
compile_opt idl2
!path = !path + ':/home/gumley/idl/PIP_programs'
print, 'Display depth: ', strcompress(depth)
print, 'Color table size: ', strcompress(!d.table_size)
print, 'Default integer type: ', size(0, /tname)
journal

Cheers,
Liam.

Practical IDL Programming
http://www.gumley.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: idl 7.0 eclipse plugins and updates
Next Topic: Europe/Africa province boundaries

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

Current Time: Sat Oct 11 07:12:42 PDT 2025

Total time taken to generate the page: 1.84045 seconds