Hi,
Could someone be kind enough to double check my code to make sure I'm
using David Fanning's fsc_colorbar.pro routine correctly? I've read
the article on his website on contiguous colors and I think I've
configured it correctly but some results are wonky so I want to rule
out plotting error. I've also downloaded a recent copy of David's
library because I know he recently changed the colorbar routine name.
Thanks in advance,
Ryan.
pro plotsnrvstemp, dates, snr, temp
;first, we handle the parameters
if n_params() lt 3 then $
message, 'plotsnrvstemp.pro->Need 3 arguments to continue'
;check for same length
if nel(dates) ne nel(snr) then $
message, 'plotsnrvstemp.pro->Need same array sizes'
if nel(snr) ne nel(temp) then $
message, 'plotsnrvstemp.pro->Need same array sizes'
;removing measurements where no temperature has been found
dummy = where(temp lt 0, COMPLEMENT=idx, NCOMPLEMENT=cnt)
if cnt gt 0 then begin
dates_a = dates[idx]
snr_a = snr[idx]
temp_a = temp[idx]
endif
;setting up the color scale for temperature
tmax = max(temp_a, min=tmin)
scale = (temp_a-tmin)/(tmax-tmin)
;set up the color table
device, Get_Decomposed=thisDecomposed
device, decomposed=0, retain=2
loadct, 33, ncolors=250, bottom=0, /silent
WHITE = fsc_color("white", !D.Table_Size-2)
BLACK = fsc_color("black", !D.Table_Size-3)
;setting up the plotting details
plotdetails = create_struct( $
'position', [ 0.10, 0.10, 0.85, 0.90 ], $
'nodata', 1, $
'background', WHITE, $
'color', BLACK, $
'xtitle', 'Date', $
'xtickunits', 'time', $
'ytitle', 'SNR' $
)
psymdetails = create_struct( $
'psym', 2, $
'color', scale*250 $
)
colorbardetails = create_struct( $
'vertical', 1, $
'right', 1, $
'bottom', 0, $
'ncolors', 250, $
'color', BLACK, $
'range', [tmin, tmax] $
)
;plot
plot, dates_a, snr_a, _Extra=plotdetails
plots, dates_a, snr_a, _Extra=psymdetails
fsc_colorbar, _Extra=colorbardetails
;return plot settings to their original values
device, decomposed=thisDecomposed
end
|