pro mg_themeriver, x, data, colors, show_lines=showLines, $
axis_color=axisColor, color=color, _extra=e
compile_opt strictarr
sz = size(data, /structure)
nlines = sz.dimensions[0]
myShowLines = n_elements(showLines) eq 0L ? -1L : showLines
if (nlines - 1L ne n_elements(colors)) then begin
message, 'incorrect number of colors'
endif
mind = min(data, max=maxd)
plot, x, x, yrange=[mind, maxd], xstyle=9, ystyle=8, /nodata, $
color=axisColor, _extra=e
xvert = [x, reverse(x), x[0]]
for line = 0L, nlines - 2L do begin
yvert = [reform(data[line, *]), $
reverse(reform(data[line + 1L, *])), $
data[line, 0L]]
polyfill, xvert, yvert, color=colors[line]
endfor
for line = 0L, nlines - 1L do begin
ind = where(myshowlines eq line, show)
if (show gt 0L) then begin
oplot, x, data[line, *], color=color, _extra=e
endif
endfor
plot, x, x, yrange=[mind, maxd], xstyle=9, ystyle=8, /nodata, $
color=axisColor, _extra=e, /noerase
end
n = 360
x = findgen(n) * !dtor
r = randomu(seed, n)
r = smooth(r, 5, /edge_truncate)
y = x * sin(x)
data = fltarr(7, n)
data[0, *] = y - 3 * r - 0.1
data[1, *] = y - 2 * r - 0.1
data[2, *] = y - r - 0.01
data[3, *] = y
data[4, *] = y + r + 0.1
data[5, *] = y + 2 * r + 0.1
data[6, *] = y + 3 * r + 0.1
mg_loadct, 16
tvlct, rgb, /get
rgb = rgb[[50, 90, 130], *]
colors = mg_rgb2index(rgb)
colors = [colors, reverse(colors)]
window, title='Theme river example', /free, xsize=600, ysize=300
device, get_decomposed=odec
device, decomposed=1
mg_themeriver, x, data, colors, show_lines=3, $
color='000000'x, thick=2, linestyle=2, $
ticklen=0.01, background='FFFFFF'x, axis_color='000000'x
device, decomposed=odec
end