ps procs

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Tue Dec 20 11:48:26 2005.


List of Routines


Routine Descriptions

HARDIMAGE -- COPY WINDOW TO POSTSCRIPT FOR 8-BIT COLOR TABLE.

[Next Routine] [List of Routines]
NAME:
hardimage -- copy window to postscript for 8-bit color table. 

PURPOSE:
	This procedure makes a postscript file of the image on the
current window and gives EXACTLY what you see on your workstation
window, including the contrast selected with (for example) XLOADCT, 
OPTIONS, REVERSE TABLE. 
Thus, if you see white on a black background and on your final printed
output you want black on a white background (AND THIS IS THE RECOMMENDED
STYLE!!! IT LOOKS BETTER AND SAVES TONER!!!), then go into XLOADCT and
use it to reverse the color table before using HARDIMAGE. 

CALLING SEQUENCE:
	HARDIMAGE
The name of the postscript file is prompted for.

REQUIRED INPUTS:
	None.


KEYWORDS:

       FILENM: the filename of the ps file. If not given, it is
prompted for; hitting return gives default name test.ps.

	NOINTERP: If undefined or zero, the byte values are scaled up to
255. If nonzero, the byte values are left unchanged.

       LANDSCAPE: The default is to produce a 'portrait' plot. If
you set landscape, it will produce a 'landscape' plot.

       XSIZE: The width of the printed plot in the X direction. See
note under YSIZE. The default is 7 inch in portrait, 9.5 inch in landscape.

       YSIZE: The width of the printed plotin the Y direction. The
default is 9.5 inch in portrait, 7.0 in landscape.
NOTE: IN ALL CASES THE ASPECT RATIO OF THE PLOT WILL BE PRESERVED.
Thus, either XSIZE or YSIZE will determine the maximum size of the plot,
depending on which is smaller.

       XOFFSET: The x offset. See code for defaults.
       YOFFSET: The y offset. See code for defaults. Be careful if
you specify this...you need to know how it is defined!

       EPS: set for encapsulated ps. Note that once it is set, it remains
set until explicitly un-set. Therefore, we explicitly un-set if it is not set.

       OUTPUTS:
       The only output is the postscript file.

COMMON BLOCKS: 
	Uses the IDL common block 'colors'.  The user doesn't need to
know anything about this. 

EXAMPLE:
	First create the grey scale image in the window and make it look
EXACTLY as you want it to look on paper. If you want the width to be
6binches, then type HARDIMAGE, xsize=6.  
Afterwards, check the postscript file using the UNIX command xv.  
If it looks OK, then make the hard copy with the UNIX command lp. 

HISTORY:
	Written by Carl Heiles. Documented 13 Dec 1997. Further work 1 Oct 98.
More revision and documentation 7 jan 00. Fixed for 24 bits 22 jan 01.

(See /dzd2/heiles/idl/gen/ps/hardimage.pro)


HARDIMAGE24 -- COPY WINDOW TO PS FOR 24 BIT COLOR

[Previous Routine] [Next Routine] [List of Routines]
NAME:
HARDIMAGE24 -- copy window to ps for 24 bit color

PURPOSE:
	THIS IS THE 24 BIT VERSION.
	This procedure makes a postscript file of the image on the
current window and gives EXACTLY what you see on your workstation
window.

CALLING SEQUENCE:
	HARDIMAGE24

REQUIRED INPUTS:
	none

KEYWORDS:

       LANDSCAPE: The default is to produce a 'portrait' plot. If
you set landscape, it will produce a 'landscape' plot.

       XSIZE: The width of the printed plot in the X direction. See
note under YSIZE. The default is 7 inch in portrait, 9.5 inch in landscape.

       YSIZE: The width of the printed plotin the Y direction. The
default is 9.5 inch in portrait, 7.0 in landscape.
NOTE: IN ALL CASES THE ASPECT RATIO OF THE PLOT WILL BE PRESERVED.
Thus, either XSIZE or YSIZE will determine the maximum size of the plot,
depending on which is smaller.

       XOFFSET: The x offset. See code for defaults.
       YOFFSET: The y offset. See code for defaults. Be careful if
you specify this...you need to know how it is defined!

OUTPUTS:
	The postscript file, whose name is prompted for.

EXAMPLE:
	First create the 24-bit color image in the window and make it look
EXACTLY as you want it to look on paper.  Then type HARDIMAGE24.  Then
check the postscript file using the UNIX command xv.  If it looks OK,
then make the hard copy with the UNIX command lp. 

HISTORY:
	Written by Carl Heiles. Origin is hardimage. 14 Oct 1999
	mofified and documented 8jan 00

(See /dzd2/heiles/idl/gen/ps/hardimage24.pro)


HARDPLOT -- COPY GRAPH ON CURRENT WINDOW TO PS, 8 BIT COLORTABLE

[Previous Routine] [Next Routine] [List of Routines]
NAME: 
HARDPLOT -- copy graph on current window to ps, 8 bit colortable

PURPOSE:
	This procedure makes a postscript file of what is displayed on
the current window. 
It prompts for the name of the output file.  Unless specified otherwise,
the postscript interchanges black/white so that plots are dark lines on 
a white background. You can specify the size and whether to make the
output image include just black/white or also grey. 

	If NBITS=1, then any nonzero pixel is given the value 255. Thus, 
if you have a graph with several colors, they all come out looking the 
same.

CALLING SEQUENCE:
	HARDPLOT
The name of the postscript file is prompted for.

REQUIRED INPUTS: 
	None.

KEYWORDS:
       FILENM: the filename of the ps file. If not given, it is
prompted for; hitting return gives default name test.ps.

	NBITS: The number of bits used to to write the postscript file. 
For a strictly black/white graph use NBITS=1 to save disk space; this
is the default. If there is shading, then use NBITS=8. For 24 bit 
color, NBITS is always 8, set internally.

	NOREVERSE: Normally the colors are interchanged, with the 
black X-windows background becoming white on the postscript plot and
the white X-window lines becoming black. This saves our toner!!
If Noreverse is specified
as nonzero, then the colors are NOT reversed. This is usually not
recommended--it uses lots of toner and makes bad-looking plots.

	LANDSCAPE: The default is to produce a 'portrait' plot. If
you set landscape, it will produce a 'landscape' plot.

	XSIZE: The width of the printed plot in the X direction. See 
note under YSIZE. The default is 7 inch in portrait, 9.5 inch in landscape.

	YSIZE: The width of the printed plotin the Y direction. The
default is 9.5 inch in portrait, 7.0 in landscape.
NOTE: IN ALL CASES THE ASPECT RATIO OF THE PLOT WILL BE PRESERVED.
Thus, either XSIZE or YSIZE will determine the maximum size of the plot,
depending on which is smaller.

	XOFFSET: The x offset. See code for defaults.
	YOFFSET: The y offset. See code for defaults. Be careful if
you specify this...you need to know how it is defined!

       EPS: set for encapsulated ps. Note that once it is set, it remains
set until explicitly un-set. Therefore, we explicitly un-set if it is not set.

	OUTPUTS: 
	The only output is the postscript file.

	EXAMPLE:
	After the plot is the way you want it, and you want the width 
to be 6 inches, type...HARDPLOT, XSIZE=8

	MODICATION HISTORY:
	Written by Carl Heiles. Modified and redocumented 1 Sep 1998.
	Modified and redocumented 7 jan 2000.

(See /dzd2/heiles/idl/gen/ps/hardplot.pro)


PSCLOSE -- CLOSE PS, OPEN X.

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
PSCLOSE -- close ps, open X.
     
 PURPOSE:
       To close the Postscript device and set the graphics output
       device back to X Windows.
     
 CALLING SEQUENCE:
       PSCLOSE
     
 INPUTS:
       None.
     
 OUTPUTS:
       None.

 KEYWORDS:
       None.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       The device is changed.

 RESTRICTIONS:
       A PostScript file must be open.

 RELATED PROCEDURES:
       PSOPEN

 MODIFICATION HISTORY:
       Written by Tim Robishaw in ancient times.

(See /dzd2/heiles/idl/gen/ps/psclose.pro)


PSOPEN -- OPEN THE POSTSCRIPT DEVICE FOR OUTPUTTING GRAPHICS TO A FILE.

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
PSOPEN -- open the PostScript device for outputting graphics to a file.
     
 PURPOSE:
       To open the PostScript device for outputting graphics to a file.
     
 CALLING SEQUENCE:
       PSOPEN, FILENAME [, /LANDSCAPE] [, XSIZE=width] [, YSIZE=height] [,
       /INCHES] [, /COLOR] [, BITS_PER_PIXEL={1 | 2 | 4 | 8}] [, 
       /ENCAPSULATED]

 Other DEVICE keywords accepted:
       [, /AVANTGARDE | , /BKMAN | , /COURIER | , /HELVETICA | ,
          /ISOLATIN1 | , /PALATINO | , /SCHOOLBOOK | , /SYMBOL | , 
          /TIMES | , /ZAPFCHANCERY | , /ZAPFDINGBATS ] [, 
        /BOLD] [, /BOOK] [, /DEMI] [, FONT_INDEX=integer] [, 
       FONT_SIZE=points] [,  GLYPH_CACHE=number_of_glyphs] [,
       /ITALIC] [, /LIGHT] [, /MEDIUM] [, /NARROW] [, /OBLIQUE] [, 
       OUTPUT=scalar string] [, SCALE_FACTOR=value] [, 
       SET_CHARACTER_SIZE=[font size, line spacing]] [, 
       SET_FONT=scalar string] [, /TT_FONT] [, 
       XOFFSET=value] [, YOFFSET=value]

	CARL: if set, selects HELVETICA/BOLD
 INPUTS:
       FILENAME : String with the name of the PostScript file to be opened.
     
 OUTPUTS:
       None.

 KEYWORDS:
       /LANDSCAPE: If set, landscape orientation is used. Portrait 
                   orientation is the default.

       XSIZE = The width of output generated by IDL. XSIZE is specified 
               in centimeters, unless /INCHES is set. def 8.0in, portrait

       YSIZE = The height of output generated by IDL. YSIZE is specified 
               in centimeters, unless /INCHES is set. def 10.5in, portrait
       
       XOFFSET = The X position, on the page, of the lower left corner of 
                 output generated by IDL. XOFFSET is specified in 
                 centimeters, unless /INCHES is set.

       YOFFSET = The Y position, on the page, of the lower left corner of 
                 output generated by IDL. YOFFSET is specified in 
                 centimeters, unless /INCHES is set.

       /INCHES : Normally, the XOFFSET, XSIZE, YOFFSET, and YSIZE keywords 
                 are specified in centimeters. However, if INCHES is 
                 present and non-zero, they are taken to be in inches 
                 instead.

       /COLOR: Set this keyword to enable color PostScript output.

       BITS_PER_PIXEL = The number of bits per pixel to use. IDL is capable 
                        of producing PostScript images with 1, 2, 4, or 8 
                        bits per pixel. Using more bits per pixel gives 
                        higher resolution at the cost of generating larger 
                        files.  The default value is 8 bits per pixel.

       /ENCAPSULATED: Set this keyword to create an encapsulated 
                      PostScript file, suitable for importing into another 
                      document (e.g., LaTeX). The file extension will be 
                      ".eps" rather than the default ".ps".

       See "Keywords Accepted by the IDL Devices" in the IDL Online Help.  
       Only keywords followed by {PS} are applicable to the PostScript 
       device.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
	The graphics device is set to PostScript.
       If FILENAME is sent in without a ".ps" or ".eps" suffix, it is
       returned with one appended to it.  Also, if the requested
       filename has a ".ps" suffix and the /ENCAPSULATED keyword is
       set, the file will be saved with a ".eps" suffix.  It is
       standard operating procedure for encapsulated PostScript
       files to end with ".eps" and this is enforced by ApJ, so
       we make it so.

 RESTRICTIONS:
       PSOPEN assumes letter-sized pages.
       PSOPEN sets the graphics device to PostScript and leaves a
       file open upon completion.  Therefore, after all graphics
       have been created for this file, it is necessary to close
       the file (DEVICE, /CLOSE_FILE) and set the graphics device
       back to the default for your machine (probably X Windows).
       PSCLOSE will do all of this for you.

 EXAMPLE:
       Make a PostScript file 5in by 5in:
         IDL> psopen, 'foo.ps', XSIZE=5, YSIZE=5, /INCHES
         IDL> plot, findgen(30)^2
         IDL> psclose

       Make a color PostScript image:
         IDL> psopen, 'foo.ps', /COLOR
         IDL> setcolors, /SYSTEM_VARIABLES
         IDL> plot, findgen(30), color=!red
         IDL> oplot, findgen(30)^2, color=!blue
         IDL> xyouts, 0.25, 0.5, /normal, 'Parabola', color=!green
         IDL> xyouts, 0.55, 0.5, /normal, 'Line', color=!magenta
         IDL> psclose
         IDL> setcolors, /SYSTEM_VARIABLES

       Make a PostScript image taking advantage of PostScript fonts
       AND the ability (unique in IDL fontdom) of PS fonts to have
       embedded formatting command indices changed:
         IDL> psopen, 'foo.ps', /HELVETICA, /BOLD, /OBLIQU, /ISOLATIN1
         IDL> device, /BKMAN, /DEMI, /ITALIC, /ISOLATIN1, FONT_INDEX=10
         IDL> plot, findgen(3), FONT=0, $
         IDL>   xtit='Galactic Radius !10'+string(174B)+'!X [kpc]', $
         IDL>   ytit='Density !10'+string(181B)+'!X [cm!E-3!N]'
         IDL> psclose

 NOTES:
       Add device keywords if you want to change font characteristics
       but remember that in order to use PostScript fonts you must either 
       set the !P.FONT system variable to 0 (so that IDL uses the 
       hardware fonts) or send any of the plotting routines the 
       FONT keyword set to 0.
       
       Remember that the PostScript device is 8-bit and has exactly
       256 color table indices.  So, on your X-windows device, if
       you're running 8-bit PseudoColor, you've probably got less
       than 256 color table indices available... if you're running
       24-bit TrueColor or DirectColor, you've got 16 million color
       indices and no color table at all.  If you're storing color
       table indices in variables, you'll need to reassign these
       variables with the correct color table indices after you've
       opened the PostScript device (and again when you've closed
       it!)

 RELATED PROCEDURES:
       PSCLOSE

 MODIFICATION HISTORY:
       Written by Tim Robishaw in ancient times.
       27 Feb 2002  Spiffed up by TR
       28 Jan 2004  Cosmetic changes. TR

(See /dzd2/heiles/idl/gen/ps/psopen.pro)


SHARPCORNERS

[Previous Routine] [List of Routines]
 NAME:
       SHARPCORNERS

 PURPOSE:
       If you look closely, especially if you make your axes thick,
       the corners of your plots are not sharp.  (Try example below.)
       This procedure makes sharp corners on your plot.

 CALLING SEQUENCE:
       SHARPCORNERS [, COLOR=value] [, THICK=value]

 INPUTS:
       None.

 KEYWORD PARAMETERS:
       COLOR = color index of the axes.
       THICK = thickness of the axes.

 OUTPUTS:
       None.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       Plot corners are now sharp!

 RESTRICTIONS:
       The thickness of the X and Y axes must be the same.

 EXAMPLE:
       IDL> plot, findgen(5), XTHICK=5, YTHICK=5
       IDL> sharpcorners, THICK=5

 MODIFICATION HISTORY:
   26 Apr 2004  Written by Tim Robishaw, Berkeley
   19 Aug 2005  TR: have to redraw the first leg after the other four in order
                for PostScript plots to have the first corner sharp.  This is
                weird since it's not necessary for X windows.

(See /dzd2/heiles/idl/gen/ps/sharpcorners.pro)