| Re: help with clipping in IDL V3.0 [message #3344 is a reply to message #3341] |
Thu, 08 December 1994 03:52  |
sjt
Messages: 72 Registered: November 1993
|
Member |
|
|
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)
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!" | |
+----------------------------------------------------------- --+---------+
|
|
|
|