| Re: Using PS_START to create A4 Landscape postscript? [message #77875 is a reply to message #77874] |
Thu, 29 September 2011 12:42  |
Matthew
Messages: 18 Registered: February 2006
|
Junior Member |
|
|
You can try something like this:
device, 'ps', filename='A4.ps', xsize=21.0/2.54 , ysize=29.7/2.54, /
inches
A4 paper is 210x297mm and there are 2.54cm/inch. To remove the
margins, you will have to do some work. After you make your last call
to DEVICE (as above), you can try the following. Define "margins" to
be a 4 element vector: [left_margin, bottom_margin, right_margin,
top_margin] where *_margin are the widths of the margins in normal
coordinates. In your case [0.0, 0.0, 1.0, 1.0].
This bit of code calculates the region and window of the plot (read
about ![xyz].region, ![xyz].window, !p.region, !p.window) in the IDL
help files. The end result, "position" will give you the location of
the plot in normal coordinates that you can pass to PLOT, etc.
Note that I have tried this in the display window, but not for ps
plots yet. I have to call PLOT to initialize the system variables
related to plots (!p and ![xyz]).
margins_norm = margins
;initialize the plot region
plot, !x.range, !y.range, /nodata, /noerase, xstyle=4, ystyle=4
;convert the margins from normal coordinates to device coordinates
;this would be useful for printing square plots to preserve aspect
ratio
margins_dev = margins_norm
margins_dev[0] = margins_norm[0] * !d.x_vsize
margins_dev[2] = margins_norm[2] * !d.x_vsize
margins_dev[1] = margins_norm[1] * !d.y_vsize
margins_dev[3] = margins_norm[3] * !d.y_vsize
;character size in normal coordinates
xcharsize = !d.x_ch_size / !d.x_vsize
ycharsize = !d.y_ch_size / !d.y_vsize
;Calculate the size of the plotting region. This is the total area of
the plot,
;including axis labels and titles
x_region = fltarr(2)
y_region = fltarr(2)
x_region[0] = 0.0 + margins_norm[0]
x_region[1] = 1.0 - margins_norm[2]
y_region[0] = 0.0 + margins_norm[1]
y_region[1] = 1.0 - margins_norm[3]
p_region = [x_region[0], y_region[0], x_region[1], y_region[1]]
;Calculate the size of the plot window. This is the region contained
within the
;axes and does not include title, ticklabels, etc.
;Note that the main title is 1.25 times larger than the normal font
size.(ycharsize*1.25).
;the axes need room for tick labels AND axis titles (xcharsize*2.0),
;and the x-axis title/offset subtracts from the space in the y-
direction
x_window = fltarr(2)
y_window = fltarr(2)
x_window[0] = x_region[0] + myttl_offset + xcharsize*2.0
x_window[1] = x_region[1] ;no labels on the right side of
the region
y_window[0] = y_region[0] + mxttl_offset + ycharsize*2.0
y_window[1] = y_region[1] - mttl_offset - ycharsize*1.25
p_window = [x_window[0], y_window[0], x_window[1], y_window[1]]
;calculate the height and width of each individual plot window
plot_width = (p_window[2] - p_window[0]) / ncols
plot_height = (p_window[3] - p_window[1]) / nrows
positions[0] = p_window[0]
positions[1] = p_window[1]
positions[2] = p_window[0] + plot_width
positions[3] = p_window[1] + plot_height
|
|
|
|