There are so many ways to save a plot or print it. Below shows three common ways in IDL Direct Graphics. I use the simple example data:
x = findgen(100)
y = sqrt(x)
METHOD 1:
Make your PLOT an IPLOT with the command:
iplot, x, y
and use the iPlot GUI's File->Print... menu button to print the plot. This is by far the easiest solution, especially for IDL "newbies".
METHOD 2:
Do your plotting in the "PRINTER" device:
set_plot, 'PRINTER' ; Initializes a buffer where printer drawing commands are stored
; This makes a 10"w x 7.5"h plot in a landscape-orientation
device, XSIZE=10.0, YSIZE=7.5, /INCHES, PORTRAIT=0
; PRINTER plots look better with thicker lines and chars
plot, x, y, THICK=2.0, CHARTHICK=2.0
device, /CLOSE ; This is the command that writes the buffer to the printer
set_plot, 'WIN' ; Restore writing output to my computer display
[Similar steps to the above can be used with the 'PS' "PostScript device" to write printer-ready output in PostScript file format.]
METHOD 3:
Just save an image of the plot, not so much for printing as for saving for display on other computers.
; Makes a 600 pixel x 400 pixel plot image. That is good for computer displays,
; but too low resolution for a printer.
window, XSIZE=600, YSIZE=400
plot, x, y
; This gives you a 3 x 600 x 400 True Color snapshot of the plot window
image = tvrd(TRUE=1)
; Stores a "lossless", efficiently-compressed PNG image of your snapshot
WRITE_PNG, 'myplot.png', image
James Jones
|