Nancy R. Galbraith (ngalbraith@whoi.edu) writes:
> Sorry, I can't find this in the manual. I need to make a "waterfall
> plot" in which the y axis applies to the first bin of data in a 2d
> time series, and the subsequent bins are offset from the first. Its
> pretty simple in a lot of plotting pkgs, but I cat see the right
> way to do it in idl. Any advice would be greatly appreciated.
I guess there are many ways to do this, but here is
a short example that I modified a bit to make it look
like your little drawing. I hope it will be enough
to give you the idea anyway.
Cheers,
David
----------------------------------------------------------
PRO Waterfall
; Create the data.
seed = 1L
data = FltArr(101, 6)
FOR count = 0, 5 DO BEGIN
row = RandomU(seed, 101)
FOR j=0,4 DO row = Smooth(row, 3)
data[*, count] = row * 30
ENDFOR
; Display window
Window, XSize=300, YSize=500
; Draw the plots.
Plot, data[*,0], XStyle=8, YStyle=4, XTitle='Time', $
Position=[0.1, 0.1, 0.9, 0.2], YRange=[0,30]
Plot, data[*,1], XStyle=4, YStyle=4, YRange=[0,30], $
Position=[0.1, 0.2, 0.9, 0.3], /NoErase
Plot, data[*,2], XStyle=4, YStyle=4, YRange=[0,30], $
Position=[0.1, 0.3, 0.9, 0.4], /NoErase
Plot, data[*,3], XStyle=4, YStyle=4, YRange=[0,30], $
Position=[0.1, 0.4, 0.9, 0.5], /NoErase
Plot, data[*,4], XStyle=4, YStyle=4, YRange=[0,30], $
Position=[0.1, 0.5, 0.9, 0.6], /NoErase
Plot, data[*,5], XStyle=4, YStyle=4, YRange=[0,30], $
Position=[0.1, 0.6, 0.9, 0.7], /NoErase
Plot, data[*,5], XStyle=4, YStyle=4, YRange=[0,30], $
Position=[0.1, 0.7, 0.9, 0.8], /NoErase
Plot, data[*,5], XStyle=4, YStyle=8, YRange=[0,30], $
Position=[0.1, 0.8, 0.9, 0.9], /NoErase
Axis, XAxis=1
END
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|