Peter Thorne wrote:
> Hi,
>
> I'm at the end of my tether on this one and would really appreciate any
> help that you can give, it may well just be a silly error on my part
> (problems seeing the woods for the trees). Polyfill seems to
> systematically shift the y-values in some plots of a multiplot by a
> random amount which leads to plots which are not what is required.
>
> The current code contains the following:
>
> !P.Multi=[0,4,7,0,0]
>
> ; Plot the values.
> ;
> for sig=0,6 do begin
> for laa=0,3 do begin
> xrange=[0,21]
> yrange=[-2,3]
> Plot,xrange,yrange,xstyle=8+1,ystyle=8+1,$
> Yticks=5,Yminor=1,Xticks=3,Xminor=1,$
> /Nodata
> ; Shade the area between the upper and lower estimates in light
> grey.
> upper=upperbeta(*,laa,sig)
> lower=lowerbeta(*,laa,sig)
> toohigh=where(upper gt 3.,hc)
> if hc gt 0 then upper(toohigh)=3.
> toolow=where(lower lt -2,lc)
> if lc gt 0 then lower(toolow)=-2
> xvalue=indgen(21)+1
> xplots=[xvalue,reverse(xvalue)]
> yplots=[lower,reverse(upper)]
> polyfill, xplots,yplots,color=1
>
> ; Over plot the variables back on the plot.
> oplot,xvalue,betabest(*,laa,sig),thick=3
> oplot,xvalue,upper
> oplot,xvalue,lower
> plots,[0,21],[0,0],thick=3
> plots,[0,21],[1,1],thick=3
> plots,[0,21],[3,3]
> plots,[21,21],[-2,3]
>
> ; Overplot crosses on the x-axis for those truncations that fail the
> test
> ; on the residuals
> residuals=where(testpass(*,laa,sig) lt 0.1, countconsfail)
> residuals=residuals+1
> if countconsfail ge 1 then begin
> pltvals=fltarr(21)
> pltvals(*)=-1.75
> oplot,residuals,pltvals,psym=2
> print,'Residuals inconsistent.'
> endif
> endfor
> endfor
>
> So, I end up with 24 plots (4x7) with three plot lines on each and an
> area of grey-shading that should be enclosed by the upper and lower
> lines. Trouble is it isn't!!! It is shifted vertically in some cases
> (either up or down) within the postscript output. I can send anyone who
> is interested in seeing exactly how an example .ps file (please email me
> if you are). I'm using IDL 5.4.
>
> Also perhaps a tad easier, is there any way to input a line between the
> 2nd and 3rd and the 4th and 5th rows of the multi-plot? IDL online help
> doesn't immediately suggest that there is ...
>
> Any help on either of these very very gratefully received.
>
> Thanks
>
> Peter
Hmmm...from examining your code nothing obvious springs to mind - however,
it seems as though your Y plot range is being reset somehow, after the
greyscale polyfill area has been drawn. Are the plots that have the problem
the same ones where the truncation condition fails? Some other things to
try/ponder:
1) I wouldn't use xrange/yrange as variable names, as these are keywords
also, causing possible confusion;
2) I thought the 'oplot' command was obsolete, maybe try using 'plots' only;
3) you could try printing out the value of !C.YRANGE (or whatever the
correct name of the sysvar is) with every pass through the loop, to ensure
that what you think is happening is what IDL thinks is happening;
4) you could simplify your code in a few places, like saying
upper = upperbeta(*,laa,sig) < 3.
lower = lowerbeta(*,laa,sig) > -2
instead of
upper=upperbeta(*,laa,sig)
lower=lowerbeta(*,laa,sig)
toohigh=where(upper gt 3.,hc)
if hc gt 0 then upper(toohigh)=3.
toolow=where(lower lt -2,lc)
if lc gt 0 then lower(toolow)=-2
fewer lines of code always makes seeing the trees a little easier! Good
luck and let us know what you come up with -
|