Coyote Graphics Routines

Date: Thu May 16 10:16:07 2013

single page | use frames     summary     class     fields     routine details     file attributes

.\

ps_start.pro


top PS_START

Utilities, Graphics

PS_START [, filename] [, /CANCEL] [, CHARSIZE=float] [, DEFAULT_THICKNESS=integer] [, FILENAME=string] [, FONT=integer] [, /ENCAPSULATED] [, /GUI] [, KEYWORDS=structure] [, /LANDSCAPE] [, /NOMATCH] [, /QUIET] [, SCALE_FACTOR=float] [, TT_FONT=string] [, _REF_EXTRA=_REF_EXTRA]

The purpose of PS_START and PS_END is to make it easy to set-up and close a PostScript file. These programs are used extensively in all Coyote Graphics routines.

If ImageMagick is installed on your computer, you can easily convert PostScript output to GIF, JPEG, PNG, and TIFF raster output. If Ghostscript is installed you can convert PostScript output to PDF files. See the appropriate keywords to PS_END.

When PS_START is called, the current graphics device is set to "PS" (the PostScript device). When PS_END is called the current graphics device is returned to the device in effect when PS_START was called.

PS_Start uses the current display window as a template for the Postscript file. Thus, if the display window is wider than it is higher, output is in Landscape mode. To set the size of the PostScript "window" yourself, be sure to set the NOMATCH keyword to 1.

To display surface plots correctly the FONT keyword should be set to 1. Otherwise, the default font is 0, or hardware fonts when outputting to PostScript.

You can easily configure any modifications you like for your PostScript output by setting fields in the plot and axis system variables (!P, !X, !Y, and !Z). The modifications currently made by default in this program are these:

!P.Thick = 3 !P.CharThick = 3 !X.Thick = 3 !Y.Thick = 3 !Z.Thick = 3 !P.Font = 0
The !P.Charsize variable is set differently on Windows computers, and depending on whether !P.MULTI is being used. On Windows the default is 1.25, or 1.00 for multiple plots. On other computers, the default is 1.5, or 1.25 for multiple plots. If true-type fonts are being used (FONT=1), the default is 1.5, or 1.25 for multiple plots.

The PS_Start program contains the common block, _$FSC_PS_START_. See the FSC_PS_SETUP__DEFINE program in the Coyote Library for its definition.

Parameters

filename in optional type=string default=idl.ps

The name of the PostScript file created.

Keywords

CANCEL out optional type=boolean default=0

An output keyword that is set to 1 if the user cancelled from PS_Config. Otherwise, set to 0.

CHARSIZE in optional type=float

If this keyword is set, the !P.Charsize variable is set to this value until PS_END is called.

DEFAULT_THICKNESS in optional type=integer default=3

Sets the following system variables to this value while creating PostScript output: !P.Thick, !P.CharThick, !X.Thick, !Y.Thick, !Z.Thick. These variables are returned to their original values by PS_End. A system variable is set to this value only if it currently contains the IDL default value of 0.0. If it is set to anything else, this default thickness value is ignored.

FILENAME in optional type=string default=idl.ps

The name of the PostScript file created. An alternative, and older, way of setting the filename parameter.

FONT in optional type=integer default=0

Set this to the type of font you want. A -1 selects Hershey fonts, a 0 selects hardware fonts (Helvetica, normally), and a 1 selects a True-Type font. Set to 0 by default.

ENCAPSULATED in optional type=boolean default=0

Set this keyword to produce encapsulated PostScript output.

GUI in optional type=boolean default=0

The default behavior is to use PSCONFIG to configure the PostScript device silently. If you wish to allow the user to interatively configure the PostScript device, set this keyword.

KEYWORDS out optional type=structure

This output keyword contains the keyword structure returned from PS_Config.

LANDSCAPE in optional type=boolean default=0

Set this keyword to produce landscape PostScript output.

NOMATCH in optional type=boolean default=0

Normally, PS_Start will try to "match" the aspect ratio of the PostScript file "window" to the current display window. If this keyword is set, then this doesn't occur, giving the user the option of specifying the size and offsets of the PostScript window directly though appropriate keywords.

QUIET in optional type=boolean default=0

If set, informational messages are not set.

SCALE_FACTOR in optional type=float default=1.0

Set this to the PostScript scale factor. By default: 1.

TT_FONT in optional type=string default=Helvetica

The name of a true-type font to use if FONT=1.

_REF_EXTRA in optional

Any keyword appropriate for the PostScript configuration program PSConfig, from the Coyote Library can be used with PS_Start.

Examples

To create a line plot in a PostScript file named lineplot.ps and also create a PNG file named lineplot.png for display in a browser, type these commands:

PS_Start, FILENAME='lineplot.ps' cgPlot, Findgen(11), COLOR='navy', /NODATA, XTITLE='Time', YTITLE='Signal' cgPlot, Findgen(11), COLOR='indian red', /OVERPLOT cgPlot, Findgen(11), COLOR='olive', PSYM=2, /OVERPLOT PS_End, /PNG

Author information

Author:

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright:

Copyright (c) 2008-2011, Fanning Software Consulting, Inc.

History:

Change History:

Written by: David W. Fanning, 20 May 2008. Slight modification to allow filenames with spaces in them. Added NoMatch keyword. 17 March 2009. DWF. Added a number of keywords to make these commands more configurable. 19 March 2009. DWF. Only set thickness system variables if starting system variables are set to their default values (namely, 0). This allows users to set their own system variables before they call PS_START, rather than after. 23 March 2009. DWF. Moved PS_END to its own file to allow the IDLExBr_Assistant to work properly. 7 April 2009. DWF. Modified to allow PostScript page type to be stored for future processing with FixPS. 9 August 2009. DWF. Added NoFix keyword to PS_END calls to repair previous, but unused set-ups. 1 Nov 2010. DWF. Added Charsize keyword to PS_START. 14 Nov 2010. DWF. Changed the way default character sizes are set. 19 Nov 2010. DWF. Added CANCEL and KEYWORDS output keywords. 16 Jan 2011. DWF. Changes to handle inability to create raster files from PS encapsulated files in landscape mode. 26 Aug 2011. DWF. The SCALE_FACTOR is called at the time the PostScript file is opened to avoid problems with the bounding box not being set to the correct values. 26 October 2011. DWF. Created a DEFAULT_THICKNESS keyword to set the default thicknesses of PostScript system variables. 14 Dec 2011. DWF. Moved the true-type font set-up to *after* changing the graphics device to PostScript. 10 Jan 2012. DWF.

File attributes

Modification date: Tue Jan 10 15:25:10 2012
Lines: 287
Docformat: rst rst