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

Home » Public Forums » archive » Re: Missing fill colours in contour plot
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: Missing fill colours in contour plot [message #82809 is a reply to message #82804] Wed, 16 January 2013 02:28 Go to previous messageGo to previous message
Sir Loin Steak is currently offline  Sir Loin Steak
Messages: 42
Registered: January 2012
Member
On Wednesday, January 16, 2013 9:51:49 AM UTC, lj...@fsmail.net wrote:
> On Wednesday, January 16, 2013 12:11:50 AM UTC, tortoise...@gmail.com wrote:
>
>> On Tuesday, 15 January 2013 22:14:04 UTC, Coyote wrote:
>
>>
>
>>> On Tuesday, January 15, 2013 1:56:23 PM UTC-7, lj...@fsmail.net wrote:
>
>>
>
>>>
>
>>
>
>>>> I am trying to do a contour plot of a latitude-longitude array, but I keep getting gaps in my plot, as shown in the following image: http://www.physics.open.ac.uk/~lsteele/contour.png. I'm stumped as to the reason, as it's not as if it's missing contours at the very end ranges of the contour values - it's somewhere in between. Anyhow, I'm sure the knowledgable folks on here will know!
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> I have defined a blue-white-red colour scheme and loaded it in with tvlct, but the problem occurs with other colour schemes too. I am calculating my contour levels and colours as follows (with ncont the number of contours I'm plotting):
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> minv = floor(min(array))
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> maxv = ceil(max(array))
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> maxval = max([abs(array),abs(array)])
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> clevels = -maxval + findgen(ncont)/(ncont-1)*2*maxval
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> ccol = floor(findgen(ncont)/(ncont-1)*250)
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> I am then plotting my contour plot as:
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> device, decomposed=0
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> bwr_colour, red_vec, grn_vec, blu_vec
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> tvlct, red_vec, grn_vec, blu_vec
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> contour, array, lon, lat, $
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> levels=clevels, c_colors=ccol, /fill, $
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> background=cgColor('white'), color=cgColor('black'), $
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> xrange=[-180,180], yrange=[-90,90], xstyle=1, ystyle=1, $
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> yticks=6, ytickv=[-90,-60,-30,0,30,60,90], $
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> xticks=6, xtickv=[-180,-120,-60,0,60,120,180], $
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> xtitle='Longitude', ytitle='Latitude', charsize=1.5, $
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> title=plotsym+' (all motions) / g m!u-1!n s!u-1!n'
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> If anyone can offer any suggestions then I'll be very grateful, as it's bugging me now!
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Just seeing "lon", "lat", and "contour" causes me to think that one of your problems is that you should be using the CELL_FILL keyword, rather than the FILL keyword.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> http://www.idlcoyote.com/color_tips/fill_colors.html
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> If that doesn't work, I'd try cgCONTOUR. That routine will fill up the "normal" hole Contour creates.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> http://www.idlcoyote.com/tips/contour_hole.php
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Cheers,
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> David
>
>>
>
>>
>
>>
>
>> Thanks David - I'll give both a try tomorrow and see what happens!
>
>
>
> Hmm, well neither cell_fill nor cgcontour fix the problem. I'll have to have another fiddle and see what I can do, but it seems like it should work!

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?

Cheers,

Liam
[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
Previous Topic: CgWindow and multiple plots
Next Topic: Matrices

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

Current Time: Sun Oct 12 07:04:59 PDT 2025

Total time taken to generate the page: 1.99979 seconds