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

Home » Public Forums » archive » Am I using FSC_colorbar correctly?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Am I using FSC_colorbar correctly? [message #73490] Thu, 11 November 2010 08:12
rchughes is currently offline  rchughes
Messages: 26
Registered: April 2006
Junior Member
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
[Message index]
 
Read Message
Previous Topic: how to stop integration in IMSL_ODE ?
Next Topic: Another issue with the garbage collector?

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

Current Time: Fri Oct 10 02:01:31 PDT 2025

Total time taken to generate the page: 1.20102 seconds