comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: beginners plotting question

Re: beginners plotting question
type: item
description: 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
creator: fireman
date: 1999-02-24T08:00:00-00:00