Coyote Library PostScript Files
These are programs from the Coyote Library that are specifically designed to work with PostScript output.
- ASPECT Calculates plot position coordinates for plot of specified aspect ratio.
- cgFIXPS Fixes IDL PostScript landscape output files so they display with proper orientation.
- FSC_PSCONFIG A full-featured program for configuring the PostScript device.
- PSCONFIG A function wrapper for graphically configuring the PostScript device.
- PS_START/PS_END Wrapper programs for opening and closing PostScript files.
- PSWINDOW Creates PostScript window with same aspect ratio as display window.
![]()
ASPECT | |
This function calculates and returns the normalized position
coordinates necessary to put a plot with a specified aspect ratio
into the currently active graphics window. This makes it easy
to produce PostScript output in the correct dimensions for measuring.
For example, here is
how I create a plot that is 2 units tall and 3 units wide:
Plot, data, Position=Aspect(2.0/3.0) The program has been updated to also work with a page of PostScript or Printer output. For example, I use it to keep the correct aspect ratio of a graphics plot when I send the plot directly to the printer (via the Printer device). For example, here is code I use in an object graphics program to make the graphics output appear on the printed page with the same aspect ratio as in the display window:
info.thisWindow->GetProperty, Dimensions=wdims
plotAspect = Float(wdims[1]) / wdims[0]
windowAspect = 11.0 / 8.5 ; Letter page. Modify for A4 page.
; Calculate the proper position on the PostScript page.
position = Aspect(plotAspect, WindowAspect=windowAspect)
; Change the dimension and location of the view to page mapping.
info.thisView->SetProperty, Dimensions=[position[2]-position[0], position[3]-position[1]], $
Location=[position[0], position[1]], Units=3
; Print the document.
info.thisPrinter->Draw, info.thisView, Vector=info.vector
info.thisPrinter->NewDocument
|
cgFIXPS | |
| This program fixes IDL PostScript landscape output so that it is displayed in PostScript viewers right-side-up rather than upside-down. It currently works only with single page PostScript output, although directions for modifying multiple page PostScript output are available. |
FSC_PSCONFIG | |
This program is my long-awaited replacement for PS_Form. Everything I did
wrong in PS_Form, I tried to do right here. This program is written as an object,
which makes it trivially easy to extend and maintain. I made it easy to add your own
system defaults, help screens, custom set-ups, paper sizes, etc. This is a program that
should never grow out of date.
![]() This program is the most sophisticated I have ever offered for free, and one of the most sophisticated I have ever written. I was trying to push and extend a number of ideas I am writing about in an upcoming IDL object programming book. Pushing the envelope in terms of what is possible is the only way I know to see how far I can really go. To that end, I am not recommending this program to anyone using versions of IDL older than IDL 5.2. Moreover, you really should use it on a 24-bit display, although it will work on an 8-bit display. (It just won't look as nice, and it will probably cause color flashing if you have other graphics on this display, as it uses the IDL object graphics class library.) The program works wonderfully well on my Windows NT 4 machine running IDL 5.3. Your mileage may vary. I've tested the program on as many machines as I can get my hands on, but I'm pretty sure it is not bug free. And I am pushing the notion of "cross-platform compatibility" as hard as I can. Please let me know if you discover problems. Because this program is as sophisticated as it is, I've written a complete on-line help page to show you how to use it. Plus, for people who really don't want to know anything about it, there is a wrapper function, PSConfig, that provides a simplified function interface to the object's graphical user interface and configuration keyword methods. PSConfig works very much like my older program, PS_Form. One of the feature's of this program is that it relies on a number of compound widget objects, which you will have to download to use with the program. These are: FSC_Droplist, FSC_FileSelect, FSC_Field, and FSC_PlotWindow. All of these programs, as well as PSConfig and PS_Plotter, an example program showing one way to use the object, are available in the Coyote Library. For additional information, please see the on-line help page. The program is now updated (9 November 2007) to allow CMYK output. |
PS_START/PS_END | |
| These two programs (in the same file) are wrappers that allow easy configuration
of PostScript output. In addition to making PostScript set-up effortless, if
ImageMagick is installed
on your machine, then you can immediately convert your PostScript output to JPEG, PNG,
or TIFF image output. The advantage of this is that your Web output takes advantage
of nice PostScript fonts.
Here is an example of creating a line plot in a PostScript file named lineplot.ps and at the same time creating a PNG file named lineplot.png for display in a browser:
PS_Start, FILENAME='lineplot.ps'
Plot, Findgen(11), COLOR=cgColor('navy'), /NODATA, XTITLE='Time', YTITLE='Signal'
OPlot, Findgen(11), COLOR=cgColor('indian red')
OPlot, Findgen(11), COLOR=cgColor('olive'), PSYM=2
PS_End, /PNG
The programs interface with PSConfig to configure the PostScript device, so any keywords appropriate to PSConfig (and there are a lot of them) can be used with PS_Start. Numerous programs from the Coyote Library are required with these programs, but be sure you get a new version of FSC_PSConfig if you are just downloading this file. |
PSCONFIG | |
| This program is a simplified wrapper function for FSC_PSConfig,
my new program for configuring the PostScript device. It is essentially a drop-in
replacement for PS_Form, an older program with similar functionality. It provides
access to FSC_PSConfig's graphical user interface for allowing
the user to configure the PostScript device, and it returns the necessary keywords
for configuring the PostScript device in exactly the same way PS_Form does.
Most of the PS_Form keywords can also be used to set the initial properties of
the graphical user interface. Be sure to read the
FSC_PSConfig on-line help for instructions.
You can download all of the programs you need from theCoyote Library. ![]() The program is used like this: keywords = PSConfig(Cancel=cancelled) IF cancelled THEN RETURN thisDevice = !D.Name Set_Plot, 'PS' Device, _Extra=keywords Plot, findgen(11) ; Or whatever graphics commands you use. Device, /Close_File Set_Plot, thisDevice The program is now updated (9 November 2007) to allow CMYK output. |
PSWINDOW | |
| This function is used to calculate the size of a PostScript window that has the same aspect ratio (ratio of height to width) as the current display graphics window. It creates the largest possible PostScript output window with the desired aspect ratio. This assures that graphics output looks similar to, if not identical to, PostScript output. This program has been updated with a PRINTER keyword that makes it useful for calculating an output window on the PRINTER device page as well. |
![]()
Version of IDL used to prepare this article: IDL 7.0.1.
![]()
![]()

