Re: Missing fill colours in contour plot [message #82802 is a reply to message #82801] |
Wed, 16 January 2013 06:47   |
Sir Loin Steak
Messages: 42 Registered: January 2012
|
Member |
|
|
On Wednesday, January 16, 2013 2:34:52 PM UTC, David Fanning wrote:
> ljs15@fsmail.net writes:
>
>
>
>> Right, I've just done some more checking, and when I specify the colour values to range from 0-255 it works, but when I set them to range from 0-250 it doesn't. The two plots are shown at http://www.physics.open.ac.uk/~lsteele/contour2.
>
>>
>
>> In the two plots shown, the left is done using ccol=floor(findgen(ncont)/(ncont-1)*255) and the right is done using ccol=floor(findgen(ncont)/(ncont-1)*250), with ncont=30. So, the only change is going from 255 to 250, with the contours being correct at 255.
>
>>
>
>> Does anyone know why this would be causing a problem?
>
>
>
> I think you have a fairly odd way of selecting colors and contours,
>
> which is causing a mismatch between the contours, the data, and the
>
> colors. What happens if you set the contours and colors up this way:
>
>
>
> minv = Floor(min(array))
>
> maxv = Ceil(max(array))
>
> ncont = 30
>
> clevels = Findgen(ncont) * ((maxv - minv) / ncont) + minv
>
> LoadCT, 25, NCOLORS=ncont, BOTTOM=1
>
> ccol= 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.")
Hi David.
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!
|
|
|