Re: Missing fill colours in contour plot [message #82779 is a reply to message #82776] |
Thu, 17 January 2013 09:34   |
Sir Loin Steak
Messages: 42 Registered: January 2012
|
Member |
|
|
On Wednesday, January 16, 2013 2:57:39 PM UTC, David Fanning wrote:
> ljs15@fsmail.net writes:
>
>
>
>> The reason for specifying the contours is that the data range from positive to negative values, and I'm using a blue-white-red colour scale to plot (+ve is red, -ve is blue).
>
>>
>
>> In order to make sure white represents 0, I need to set the contour levels to span the maximum range. So if the data had minv = -20 and maxv = +50, I want the contours to range from -50 to +50.
>
>>
>
>> There may be a better way of doing it than what I'm doing though!
>
>
>
> Well, I would do it like this:
>
>
>
>
>
> maxval = Max(Abs(array))
>
> clevels = Scale_Vector(Findgen(ncont), Floor(-maxval), Ceil(maxval))
>
> cgLoadCT, 22, /Brewer, /Reverse, NCOLORS=ncont, BOTTOM=1
>
> ccols = Bindgen(ncont)+1B
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Much neater than my hackneyed version. I'll revert to this method - thanks David.
P.S. I never realised there were Brewer colour tables. Whenever I've wanted blue-white-red I've always created my own. This will make my life much easier!
|
|
|