;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Select postscript output ; ; Modified 06 Jun 2001 by LDT: added /journal option ; to produce optimal plot for APS/OSA journal (specifically based on ; Optics Letters). ; ; Modified 30 Aug 2000: shift away from page boundary a tad ; ; This version has built-in /close option to switch back to X ; and built-in /print option to do /close and also print the file ; ; Written by: Robert Scholten ; School of Physics ; University of Melbourne ; Australia ; r.scholten@physics.unimelb.edu.au ; ; Currently defaults to color, 8-bit, Helvetica font, portrait, half-page ; ; Standard call: ; postscript,'filename.ps' ; ; Options: ; /greyscale default is color; select /greyscale if color not required ; /eps enable Encapsulated Postscript output ; /landscape landscape ; /fullpage full page size ; /help displays this stuff ; /close close file and switch back to screen device ; /print close file, send it to lpr, and switch back to screen device ; /journal setup postscript output for size/thickness/font etc for journal ; ; Note that landscape is not possible for EPS ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; WARNING!!! You'll get lousy output unless you first display on screen, ; then switch to postscript. ; ; WARNING!!! The postscript BoundingBox is often bad. ; This is particularly true for EPS files. ; If necessary, replace the BoundingBox comment with a full page: ; ; %%BoundingBox: 0 0 612 792 ; ; WARNING!!! If you EVER give an /Encapsulated keyword to the ; PostScript device, PV-WAVE remembers. To set ; Encapsulated off, you must use ; ; device,encapsulated=0 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PRO postscript, f_name, GREYSCALE=greyscale, EPS=eps, LANDSCAPE=landscape, FULLPAGE=fullpage, JOURNAL=journal, HELP=help, CLOSE = close, PRINT = print_close COMMON Postvars, ScreenDevice, psf_name IF KEYWORD_SET(close) THEN BEGIN ; close file and return to screen device (X or win32) device,Encapsulated=0 device,/close ; go back to screen set_plot, ScreenDevice return END IF KEYWORD_SET(print_close) THEN BEGIN ; close file, print, and return to screen device (X or win32) device,Encapsulated=0 device, /close spawn,'lpr '+psf_name ; go back to screen set_plot, ScreenDevice return END IF KEYWORD_SET(help) THEN BEGIN print print,'***** Help for POSTSCRIPT procedure *****' mydir=getenv('WAVE_DIR') print,'See '+mydir+'/lib/local/postscript.pro for this procedure' print print,' postscript,''filename'',options' print print,'Options include:' print,' /greyscale select greyscale output rather than colour' print,' /eps enable Encapsulated Postscript output' print,' /landscape select landscape format (default is portrait)' print,' /fullpage default size is half page; use /fullpage to double' print,' /print close Postscript file, send to lpr, and switch back to screen' print,' /journal produce output for APS/OSA journals' print,' /close close Postscript file and switch back to screen' print,' /help this help message' print RETURN ENDIF ; remember current output device for later switch back ScreenDevice = !D.name xcharx=1.0*!d.x_ch_size/!d.x_size ; size of screen char (x) xchary=1.0*!d.y_ch_size/!d.y_size ; size of screen char (y) psf_name='idl.ps' if n_elements(f_name) gt 0 then psf_name=f_name set_plot,'ps' ; Assume portrait, half-page portland='p' fullhalf='h' a4_xsize=8.3 ; A4 page size (inches) a4_ysize=11.7 ; A4 page size (inches) default_xsize=7.8 ; inches default_ysize=5.0 ; inches default_xoff=0.0 ; x offset default_yoff=0.25 ; y offset ps_xsize=default_xsize ; size of PS plot (x) ps_ysize=default_ysize ; size of PS plot (y) ps_xoff=default_xoff ; offset x ps_yoff=default_yoff ; offset y IF KEYWORD_SET(fullpage) THEN ps_ysize=2.0*default_ysize ; If landscape, swap X and Y sizes, and shift ; Don't do this if EPS IF (KEYWORD_SET(landscape) and not KEYWORD_SET(EPS)) THEN BEGIN print,'landscaping...' ps_xsize=ps_ysize ps_ysize=default_xsize ps_yoff=a4_ysize-1.0 ; 1.0 gives a reasonable margin ENDIF ; Set the size and so on for journal plots ; Rob had it in inches (?) ; Should be 86 mm by about 60 mm ; You will have problems with the below if you have ; - a plot title ; - a scale on the RHS y-axis IF (KEYWORD_SET(journal)) THEN BEGIN ps_xsize = 86.0 / 25.4 ps_ysize = 60.0 / 25.4 ps_xoff = 1.0 ps_yoff = a4_ysize-4.0 !P.thick = 1.0 !X.THICK = 1.79 ; Yields 0.5 pt lines !Y.THICK = 1.79 !X.STYLE = 9 ; 8 (supress box) + 1 (exact axis range) !Y.style = 9 !X.margin=[10,1] ; Need one on the right for exponents etc !Y.margin=[3,0] device, font_size = 8 ENDIF ; Now setup the device device, bits_per_pixel = 8, SET_FONT='Helvetica', /Bold, file = psf_name IF (KEYWORD_SET(landscape) and not KEYWORD_SET(EPS)) THEN $ device,/landscape ELSE device,/portrait IF KEYWORD_SET(eps) THEN device,/encapsulated IF (not KEYWORD_SET(greyscale)) THEN device,/color ; Define sizes last (because otherwise they get screwed up) ; print,'x,y sizes are ',ps_xsize,ps_ysize device,xsize=ps_xsize,ysize=ps_ysize,xoff=ps_xoff,yoff=ps_yoff,/inches psxx=1.0*!d.x_ch_size/!d.x_size ; PS char size (X) psyy=1.0*!d.y_ch_size/!d.y_size ; PS char size (Y) ;IF(NOT KEYWORD_SET(journal)) THEN $ ; !P.charsize = (xcharx/psxx + xchary/psyy)/2.0 print,'Future output directed to file '+psf_name end