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

Home » Public Forums » archive » Contour Plot with Handful of Colors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Contour Plot with Handful of Colors [message #77557] Wed, 07 September 2011 19:45
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: ENVI_CONVERT_FILE_MAP_PROJECTION processing times
Next Topic: windows 64 bit test

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

Current Time: Wed Oct 08 11:40:02 PDT 2025

Total time taken to generate the page: 0.00518 seconds