Place this part of the code somewhere near the
top of your program, at least before the "plot" or "contour" command.
Set_PLOT, 'PS'plotgre.ps is the name of the postscript file to be created--it must end in .ps
DEVICE, FILENAME = 'plotgre.ps'
After you have made your plot, you can close the file. It isn't necessary to use this unless you spawn to a printer or, as in this case, the output is redirected to the X Windows monitor after the postscript file is written (although this feature doesn't always work). Use 'WIN' for Microsoft Windows, and 'MAC' for Macintoshes. For a complete listing see table 8-1 of the IDL Reference Guide.
DEVICE, /Close_FileAn example where this is used in a program is plotber.pro
Set_Plot, 'X'
DEVICE, /Encapsulated
You should note, that encapsulated files will not print on a PostScript printer by themselves. In fact, you also won't be able to view the encapsulated files in other documents unless you use /Preview:
DEVICE, /Encapsulated, /Preview