Re: HELP: IDL Aspect problem on contour plots [message #2755] |
Thu, 22 September 1994 06:05 |
landers
Messages: 45 Registered: May 1993
|
Member |
|
|
iotov@cco.caltech.edu (Mihail S. Iotov) writes:
|> This is a seemingly trivial question that we could not solve by poking into the
|> manuals.
|>
|> The contour plot comes fine, but the scale on the x axis is twice that on the y
|> axis. So the whole picture is stretched in one direction.
|> Is there a way to fix this.
|>
|> Thanks a lot,
|> Mihail Iotov
|>
To make a plot come out square on your paper or display, you do some thing(s)
like this:
; First, you must make a plot to establish the plot coordinates
; Use NoData, and [XY]Style=4 to keep from drawing anything
; The NoErase is there to prevent an extra blank sheet of paper
; if you are using a paper-based device
plot, [0], /Nodata, XStyle=4, YStyle=4, /NoErase
; Now you can determine where this plot is:
; these are 2-element vectors in device coords
px = !x.window * !d.x_vsize
py = !y.window * !d.y_vsize
; and it's size
sx = px(1) - px(0)
sy = py(1) - py(0)
; now shrink the larger one to force the plot area to be square
; with a bit more thought, you could come up with any aspect ratio
wx = sx < sy
wy = wx
; figure the center of the plot space
; well, twice the center location
cx = px(0)+px(1)
cy = py(0)+py(1)
; Set a position vector
; re-center the plot in the available area
pos = [ cx-wx, cy-wy, cx+wx, cy+wy ] / 2.
; now you can make your plot, contour, etc...
plot, whatever, Position=pos
contour, things, Position=pos
; etc...
--
;Dave
|
|
|