Re: help with clipping in IDL V3.0 [message #3340] |
Thu, 08 December 1994 09:57  |
candey
Messages: 6 Registered: March 1994
|
Junior Member |
|
|
In article <3c6s1l$j6m@sun4.bham.ac.uk>, sjt@xun8.sr.bham.ac.uk (James Tappin) wrote:
> Patti Twigg (stpat@lepvax.gsfc.nasa.gov) wrote:
> : Hi! I am trying to get my program to ignore any points outside
> : of the plot window, but based on my reading of the manual,
> : this seems to be impossible - there seems to be only 2 choices:
> : 1) clip plot to axis, where point outside is joined to first
> : point inside starting at the axis, and 2) point outside is
> : joined with line extending beyond the axis. I hope maybe I
> : missed something in the manual - is there any way to get
> : the plot to ignore points outside the axes?? (In Version 1.0,
> : there was an option to do this, called IGNORE).
>
> : Thanks for any help!!
>
> : Patti Twigg
> : stpat@lepvax.gsfc.nasa.gov
> : (pg 162, misc.kids pa)
>
> : *the account I post from is under the name of my supervisor*
> : *opinions expressed are mine alone! *
>
> You can do it manually, but it's a bit tedious.
>
> Let us suppose:
> X & Y are the data arrays (very original).
> XMIN, XMAX, YMIN and YMAX are the limits you want to clip to.
>
> First: set up your axes, transformations etc.
>
> PLOT, /nodata, xrange=[xmin,xmax], yrange=[ymin,ymax], fltarr(2), $
> xsty=1, ysty=1
>
> Next: Determine the locations of the points to be omitted.
>
> clips = where(x lt xmin or x gt xmax or $
> y lt ymin or y gt ymax, nclips)
#######
;You could also use the maxvalue keyword
yy = y
if (nclips gt 0) then yy(clips) = ymax+1
oplot, x, yy, max=ymax
#######
> clips = [-1, clips, n_elements(x)]
>
> Then: Plot it a segment at a time
>
> for jclip = 0, nclips do begin
> js = clips(jclip)+1
> je = clips(jclip+1)-1
> if (js le je) then oplot, x(js:je), y(js:je)
> endfor
>
> Not wondrously clever but I think it'll do the job. Based on a procedure
> I use to leave gaps in plots where end times and start times don't meet.
>
> --
> +------------------------+---------------------------------- --+---------+
> | James Tappin, | School of Physics & Space Research | O__ |
> | sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
> | "If all else fails--read the instructions!" | |
> +----------------------------------------------------------- --+---------+
|
|
|