Problem with PLOT limits in IDL v3.6 [message #2857] |
Thu, 08 September 1994 11:50 |
joel
Messages: 5 Registered: May 1994
|
Junior Member |
|
|
I have found a problem in the PLOT routine of IDL v3.6. In short: it does not
correctly set the plot limits (e.g., XRANGE) when I try to explicitly define
the tick marks and labels (e.g., with XTICKV). I have tried a workaround with
the AXIS procedure, but it has the same problem as the PLOT procedure. This
problem only appears in IDL v3.6, but worked just fine in v3.5 and earlier.
Below is some example code to show the problem:
x=indgen(25) ; data from 0 to 24
!X.RANGE=[3.5,18.5] ; desired plot range to be from 3.5 to 18.5
!X.STYLE = 1 ; don't round off the plot limits
!X.MINOR = 5 ; five minor ticks per labeled major tick
; The following plot command works correctly, plotting only X axis range of 3.5
; to 18.5
plot, x, x
; However, if I desire all integer value tick marks to be labeled, the
; following plot command SHOULD work, and it does in IDL v3.5...but it doesn't
; in IDL v3.6. In v3.6, the PLOT command incorrectly sets the range of the X
; axis to the limits of the XTICKV values (4 to 18) rather than the XRANGE
; values (3.5 to 18.5)!
xtv = indgen(15) + 4 ; desired tick values are all integers from 4 to 18
plot, x, x, xticks=14, xtickv=xtv
; Here's one (unsuccessful) kludge I've tried to fix this bug:
; The following command fixes the range, but adds labels at 3.5 and 18.5, and
; changes the spacing of the minor tick marks at the ends of the axis.
plot, x, x, xticks=16, xtickv=[!X.RANGE(0),xtv,!X.RANGE(1)]
; The following command removes the labels at 3.5 and 18.5, but the minor tick
; marks are still spaced incorrectly at the end of the axis.
plot, x, x, xticks=16, xtickv=[!X.RANGE(0),xtv,!X.RANGE(1)], $
xtickname=[" ",strtrim(xtv,2)," "]
Any comments/workarounds would be appreciated.
Joel Parker
parker@kuylym.gsfc.nasa.gov
|
|
|