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

Home » Public Forums » archive » Re: How to handle gaps in plot?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to handle gaps in plot? [message #45113 is a reply to message #45104] Thu, 11 August 2005 23:13 Go to previous messageGo to previous message
peter.albert@gmx.de is currently offline  peter.albert@gmx.de
Messages: 108
Registered: July 2005
Senior Member
Hi,

if you know a priori what the "good" interval should be, i.e. a
threshhold for intervals between x values that marks gaps, you could
identify those gaps and plot from one gap to the other using, please
forgive me, evil for loops.

In your example, this threshhold would be 1 (hour), and the example
code would look like this:

IDL> interval = 1
IDL> x=[1,2,3,5,6,7,10,11,12,19,20,21,22,23,24]
IDL> y= [1.1,0.9,1.3,1.6,2.1,0.7,2.3,0.1,0.3,0.6,0.9,1.4,1.3,1.7,1.8 ]
IDL> gap=[-1,where(shift(x, -1)-x ne interval, n)]
IDL> plot, x, y, /nodata
IDL> for i=0,n-1 do oplot, x[gap[i]+1:gap[i+1]], y[gap[i]+1:gap[i+1]],
psym=-4

with the "shift" and "where" command I am checking where the interval
between adjacent x values exceeds the threshhold. The values in the
variable gap always give the last index of one connected x interval, so
in the following oplot command I am plotting from gap[i]+1 to gap[i+1].
Therefore we need the -1 as the first element in gap.

Best regards,

Peter
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Speeding Up Oracle DataBase Access with IDL DataMiner
Next Topic: Re: Check if a point is inside a polygon mesh

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

Current Time: Sat Oct 11 15:12:18 PDT 2025

Total time taken to generate the page: 2.31772 seconds