Folks,
I am trying to reproduce a filled contour plot with
a colorbar with a handful (9, in this case) of colors.
Does anyone know how to produce a function graphics
color bar with less than 256 colors? Also, I can't
get my function graphics filled contour to use the
colors I am trying to assign to it. :-(
Any ideas?
;*********************************************************
PRO ContourPlots, LABEL=label
; Create a simple, random dataset for contouring:
data = RANDOMU(-3L, 9, 9)
levels =[0.05, 0.1, 0.15, 0.2, 0.3, 0.44, 0.6, 0.75]
; cgContour
cgWindow, WXSIZE=500, WYSIZE=400
cgLoadCT, 33, NColors=8, Bottom=1
cgCONTOUR, data, LEVELS=levels, LABEL=Keyword_Set(label), $
/FILL, C_Colors=Indgen(8)+1, Position=[0.1, 0.1, 0.9, 0.8], /WINDOW
cgCONTOUR, data, LEVELS=levels, LABEL=2, /OVERPLOT, $
COLOR='charcoal', /AddCmd
cgColorbar, NColors=8, Bottom=1, /FIT, RANGE=[0,1], $
DIVISIONS=4, /AddCmd
; Contour function.
w = Window(DIMENSIONS=[500, 400])
cgLoadCT, 33, NColors=8, Bottom=1, RGB_TABLE=rgb, /ROW
ctr=contour(data, C_VALUE=levels, AXIS_STYLE=2, /CURRENT, $
RGB_TABLE=rgb, /FILL, Position=[0.1, 0.1, 0.9, 0.8], $
RGB_INDICES=Indgen(8)+1)
cb = Colorbar(TARGET=ctr, Position=[0.1, 0.85, 0.9, 0.9])
IF Keyword_Set(label) THEN ctr.C_LABEL_SHOW=Replicate(1,8)
END
;*********************************************************** ***
Thanks,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|