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!" | |
> +----------------------------------------------------------- --+---------+
|
|
|
Re: help with clipping in IDL V3.0 [message #3341 is a reply to message #3340] |
Thu, 08 December 1994 09:37  |
sterner
Messages: 106 Registered: February 1991
|
Senior Member |
|
|
stpat@lepvax.gsfc.nasa.gov (Patti Twigg) writes:
> 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).
Normal IDL plots are clipped correctly with no problem.
To see this generate some data:
a=findgen(50)*144/!radeg
r=findgen(50)*10
x=r*cos(a)
y=r*sin(a)
plot,x,y,xran=[-200,200],yran=[-200,200]
What may be confusing is that PLOTS, unlike PLOT, does not
by default clip to the plot window. To see this:
erase
plots, x, y
Setting the NOCLIP keyword to 0, NOCLIP=0, enables clipping
(you might expect to do /CLIP, but CLIP is used to set the
clipping window (which defaults to the plot window)).
erase
plots,x,y,noclip=0
Take a loop at the keywords NOCLIP and CLIP.
Ray Sterner sterner@tesla.jhuapl.edu
The Johns Hopkins University North latitude 39.16 degrees.
Applied Physics Laboratory West longitude 76.90 degrees.
Laurel, MD 20723-6099
WWW Home page: ftp://fermi.jhuapl.edu/www/s1r/people/res/res.html
|
|
|
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!" | |
+----------------------------------------------------------- --+---------+
|
|
|