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

Home » Public Forums » archive » Re: beginners plotting question
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: beginners plotting question [message #14384] Wed, 24 February 1999 00:00
fireman is currently offline  fireman
Messages: 49
Registered: August 1991
Member
Nan Galbraith (ngalbraith@whoi.edu) wrote:
: I'm plotting a data return timeline. I'm forcing the value of good data
: to 0 and missing data to 9999, then plotting with a range of +/- 1. I'd
: like to mark the start and end of the lines with a symbol of
: some kind, like this:

: bin 1 |--------------| |--------------------|
: bin 2 |------------------------|
: bin 3 |---------------------------------|

: Is there a first-difference function? I could use that if I could find it,

Yes - use SHIFT.

Try something like this:

IDL> dataflag=[0,0,0,0,1,1,1,0,0,0,0,0,0] * 9999
IDL> diff=dataflag-shift(dataflag,1)

IDL> N=n_elements(dataflag)
IDL> ends=where(diff ne 0,intervals)
IDL> ends=[0,ends,N-1] ; assumes you have data at start,stop

IDL> t=indgen(N)
IDL> plot,t,dataflag,yrange=[-1,1],/nodata

IDL> for i=1,n_elements(ends)-1,2 do $
oplot,t[ends[i-1]:ends[i]],dataflag[ends[i-1]:ends[i]]*0, linestyle=-1

--
-- Gwyn F. Fireman
-- General Sciences Corporation / MODIS Characterization Support Team
-- Gwyn.Fireman@gsfc.nasa.gov 301-352-2118
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: RANDOMU bug (and HTML help)
Next Topic: beginners plotting question

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

Current Time: Wed Oct 08 17:10:21 PDT 2025

Total time taken to generate the page: 0.00736 seconds