Using OOB Colors with Filled Contour Plots [message #79977] |
Fri, 20 April 2012 11:16  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
Several months ago I introduced the notion of out-of-bounds
colors into cgColorbar. These can be set with the OOB_LOW
and OOB_HIGH keywords.
Since then several people (including me!) have been
confused over how to use the out-of-bounds colors with
filled contour plots. I had a reason to have another
go at this problem today, and I have written an article
that I hope will shed some light on this difficult
topic.
The problem really is a fundamental one of how the IDL
Contour command decides which contour "level" to color.
You have to do a few fancy dance steps to work around
this problem and get consistent results with both the
FILL and CELL_FILL keywords.
I think the article will make it easier for people to
set up these results in a more consistent way. You
can find the article here:
http://www.idlcoyote.com/cg_tips/oobcontour.php
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Using OOB Colors with Filled Contour Plots [message #80044 is a reply to message #79977] |
Mon, 23 April 2012 15:22  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matteo writes:
> thanks this is helpful! In the tutorial it might be beneficial to
> substitute:
> Levels=[Min(data),levels]
> with:
> Levels=[Min(data)-1,levels]
> or something like that. This way, the code works regardless of whether
> we have OOB values. In a situation where min(data) is the first level,
> a situation of the kind levels=[ 0.0, 0.0, ...] is created, which
> cannot be contoured.
>
> Am I right?
Well, I'm not sure. I almost always have Min(data) as
the first contour level, because I don't like the
background color "showing through" my contour plot.
And, which color "shows through" depends on whether
you are using the FILL or CELL_FILL keyword, which
also bothers me.
You have to be a little careful about subtracting
1 in a general case like this. It works with most
"reasonable" data, but always seems to fail when
you work with real-world data or are giving an
important demo of your software. Better to have
a firm theoretical understanding of why you are doing
what you are doing! ;-)
> (one of the "TVLCT" commands is also misspelled)
Humm. Thought I fixed that. Maybe I didn't upload the
fixed version. I'll check.
Thanks!
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Using OOB Colors with Filled Contour Plots [message #80047 is a reply to message #79977] |
Mon, 23 April 2012 14:18  |
Matteo
Messages: 28 Registered: August 2011
|
Junior Member |
|
|
David,
thanks this is helpful! In the tutorial it might be beneficial to
substitute:
Levels=[Min(data),levels]
with:
Levels=[Min(data)-1,levels]
or something like that. This way, the code works regardless of whether
we have OOB values. In a situation where min(data) is the first level,
a situation of the kind levels=[ 0.0, 0.0, ...] is created, which
cannot be contoured.
Am I right?
(one of the "TVLCT" commands is also misspelled)
On Apr 20, 2:16 pm, David Fanning <n...@idlcoyote.com> wrote:
> Folks,
>
> Several months ago I introduced the notion of out-of-bounds
> colors into cgColorbar. These can be set with the OOB_LOW
> and OOB_HIGH keywords.
>
> Since then several people (including me!) have been
> confused over how to use the out-of-bounds colors with
> filled contour plots. I had a reason to have another
> go at this problem today, and I have written an article
> that I hope will shed some light on this difficult
> topic.
>
> The problem really is a fundamental one of how the IDL
> Contour command decides which contour "level" to color.
> You have to do a few fancy dance steps to work around
> this problem and get consistent results with both the
> FILL and CELL_FILL keywords.
>
> I think the article will make it easier for people to
> set up these results in a more consistent way. You
> can find the article here:
>
> http://www.idlcoyote.com/cg_tips/oobcontour.php
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|