; This MAIN_PROGRAM is a demo of how to make publication quality output in ; IDL using Postscript fonts. The program can also be run on X displays ; with the Hershey Triplex font, but special characters will not come out ; looking the same (the price you pay for better quality printed output.) ; See also charsets.pro which prints out the characters sets to the printer. ; Send comments or changes to: deutsch@astro.washington.edu (Eric Deutsch) ; ; You can run this program with something like: ; IDL> setps,/landscape ; direct output to landscape Postscript ; IDL> .run psspecxmpl.pro ; run this program to generate spectrum ; IDL> psclose,auto='sol' ; send output to printer queue sol wl=indgen(2000)*4+1000 ; generate wavelength array spec=sin(wl/1850.)*3+4+randomu(seed,2000) ; generate a noisy sine wave if (!d.name eq 'PS') then begin ; If Postscript output mode !p.font=0 ; select hardware fonts device,/helv,/isolatin1 ; Helvetica ISOLatin fontset ang=string(197B) ; Angstrom sym char string thk=4 ; thick borders are nice endif else begin ; If screen or other output mode !p.font=-1 ; select Hershey fonts xyouts,0,0,/norm,'!17' ; Set to Triplex Roman font ang='!3'+string(197b)+'!X' ; only Simplex Angstrom thk=1 ; use regular thickness endelse ; Now create the plot. Note that !U is for superscript (Up) and !N is ; for Normal letter sizes. plot,wl,spec,yr=[0,10],xstyle=1, $ xtitle='Wavelength ('+ang+')', $ ytitle='Flux (10!U-13!N erg cm!U-2!N s!U-1!N '+ang+'!U-1!N)', $ title='Artificial Spectrum', $ xcharsize=1.5, ycharsize=1.5, xthick=thk, ythick=thk ; print a legend-style string with some fancy characters. !9 switches to ; the Postscript Symbol font. !X switches back to the initial font. ; string(nnnB) is a way to generate a string containing a character of ; ASCII value nnn (You NEED the 'B'). xyouts,2000,9,/data,'H!9b!X: !9s '+string(179B)+'!X 4.23'+string(215B)+ $ '10!U-13!N '+string(177B)+' 0.54',charsize=2 ; also here's a fancy example of printing world coordinates. !S is save ; a position and !R is to restore to that position. degsym='!9'+string(176B)+'!X' minsym='!9'+string(162B)+'!X' secsym='!S.!R!9'+string(178B)+'!X' xyouts,2000,8.2,/data,charsize=2,'!9a!X(1950)=15!Uh!N37!Um!N23!S.!R!Us!N31'+$ ' !9d!X(1950)=+56'+degsym+'34'+minsym+'15'+secsym+'2' end