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

Home » Public Forums » archive » Re: How do you color contour levels/ranges?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How do you color contour levels/ranges? [message #13221] Wed, 21 October 1998 00:00
eddie haskell is currently offline  eddie haskell
Messages: 29
Registered: September 1998
Junior Member
> I am trying to fill in different contour levels of a 3D plot. I have 10
> What I am trying to do is to shade a given "altitude range" with the same color.

as the previous reply mentioned, you can set an array of shades for use
in your contour and surface calls. the following code snippet gives an
example of this. you can use any levels you choose. this method
requires that you allocate an additional array of the same size as your
original data set. there probably is an better way of setting the
contours array then through my use of a for loop but this works for this
example. note: to make this more 'all purpose', you would have to
account for data lt the min or gt the max of the specified levels and
some checking would have to account for the possibility of a contour
level containing no data, i.e., the where() function returning a -1.

;create sample data set
data = bytscl(exp(-((shift(dist(200,160), 100, 80))/50)^2))
data = bytscl(fix(shift(data, 60, 0)) + shift(data, -60, 0))/3b-194.

;load some colours into the colour table
for i=1,10 do $
tvlct,255*(i mod 3 ne 2),255*(i mod 3 eq 1),255*(i mod 3 ne 0),i

levels=[-200,-190, -180, -170,-160,-150,-140,-130,-120,-110,-100]
contours = data
for i=0,n_elements(levels)-2 do $
contours[where((data ge levels[i]) and (data lt levels[i+1]))]=i+1
surface,data,shades=contours,/save
contour,data,levels=levels,/follow,/t3d,/overplot

cheers,
eddie

----- ---- --- ---- --- --- --- --- -- -- -- - - - -
|\ A. G. Edward Haskell
|\ Center for Coastal Physical Oceanography
|\ Old Dominion University, Norfolk VA 23529
|\ Voice 757.683.4816 Fax 757.683.5550
|\ e-mail haskell*ccpo.odu.edu
----- ---- --- ---- --- --- --- --- -- -- -- - - - -
[Message index]
 
Read Message
Previous Topic: adjustimg brightness of an image
Next Topic: Q: write to clipboard

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

Current Time: Fri Oct 10 11:56:40 PDT 2025

Total time taken to generate the page: 0.88152 seconds