comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: polyfill errors?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: polyfill errors? [message #26332] Thu, 23 August 2001 02:07
Peter Thorne is currently offline  Peter Thorne
Messages: 13
Registered: October 2000
Junior Member
> 4) you could simplify your code in a few places, like saying
>
> upper = upperbeta(*,laa,sig) < 3.
> lower = lowerbeta(*,laa,sig) > -2

The first few points are f.nan values in all these plots, but its a
non-regular number of points, so I have to use clunky code to avoid
resetting these (normally this criticism more than applies to my code,
but this time for once it doesn't!). Which goes some way to explaining
the solution to the problem ...

> Good
> luck and let us know what you come up with -

Our IDL guru scratched his head and tried a number of things, eventually
coming up with this ...

kl=where(finite(yplots))
polyfill, xplots(kl),yplots(kl),color=1,/data

And voila, the damn thing now works! Obviously polyfill was having
trouble with f.nan values displacing the entire y-axis in some way (we
have absolutely no idea why!) - does it tell you this in the IDL help?
NO. Grrrrrrr. Anyway, it now works which is the main thing.

Thanks for your suggestions Med and Craig.

Peter
Re: polyfill errors? [message #26336 is a reply to message #26332] Wed, 22 August 2001 21:39 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Peter Thorne <peter.thorne@uea.ac.uk> writes:

> 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.
>

Hi Peter--

I do exactly the kind of thing you are talking about in my routine
PLOTCOLORFILL (although there is a lot of other baggage there). I
don't recall having problems, and I do lots of postscript output with
it.

The only thing I don't see in your call to POLYFILL is the use of the
/DATA keyword, which ensures that the polygon is in data coordinates.
That may help.

Med, I always use OPLOT, and hardly ever PLOTS. It's not obsolete!
With PLOTS you have to be sure to say NOCLIP=0 and /DATA, which is
done automatically for OPLOT. I think of OPLOT being for plotting
data while PLOTS is for plotting lines and art.

[ Also I do use keyword names as variable names, at least when they
match the exact keyword they are being passed to, i.e. XRANGE=XRANGE,
but that is a matter of personal taste. ]

Craig
Re: polyfill errors? [message #26337 is a reply to message #26336] Wed, 22 August 2001 20:11 Go to previous message
Med Bennett is currently offline  Med Bennett
Messages: 109
Registered: April 1997
Senior Member
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 -
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: _ref_extra
Next Topic: DLM obtaining structures

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:53:38 PDT 2025

Total time taken to generate the page: 0.00480 seconds