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

Home » Public Forums » archive » trigrid + triangulate -> zero values -> ignore zeros on cgcontour
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: trigrid + triangulate -> zero values -> ignore zeros on cgcontour [message #87380 is a reply to message #87379] Wed, 29 January 2014 08:17 Go to previous messageGo to previous message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
Well, there's always RTFM :-)

"Ignoring" values is simple. Simple start your levels at a value greater than the one you want to ignore. Case in point:

n=101 ;number of grid pts

;define the grid
x = findgen(n)/(n-1) & y = findgen(n)/(n-1)
xGrid = x # REPLICATE(1., n)
yGrid = REPLICATE(1., n) # y

z = SQRT(xGrid^2 + yGrid^2) ;make some data

levels = [0., 0.25, 0.5, 0.75, 1.]
;levels = [0.25, 0.5, 0.75, 1.] ;uncomment this out to "ignore" < 0.25
nLevels = N_ELEMENTS(levels)

cgLOADCT, 33, RGB_TABLE=rgb ;get a palette, but don't load the table

colorInd = cgSCALEVECTOR(LINDGEN(nLevels), 0, 255) ;select some colors from the paleete
rgbNew = rgb[colorInd, *] ;get *just* these colors

cgContour, z, x, y, LEVELS=levels, PALETTE=rgbNew, /CELL_FILL ;plot with only the colors you want

tNames = [STRCOMPRESS(levels, /REMOVE), ' '] ;get some ticknames

;plot the colorbar, with your palette
cgCOLORBAR, PALETTE=rgbNew, Divisions = nLevels, /FIT, TICKNAMES=tnames, /DISCRETE

Notice I don't actually load any color tables. There's no need.

Using the palette as I do above allows you to be a little more explicit with the colors you send to (cg)Contour and cgColorBar. I prefer to do these sort of plots in this manner. I also rarely need a continuous color bar - my work is usually much better suited for discrete cb's - so this allows me to ensure the colors match in the contour and cb.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How can I change from qwerty keyboard to azerty ?
Next Topic: How to obtain running averages for different time scales in IDL?

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

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

Total time taken to generate the page: 0.72027 seconds