strange things in CONTOUR [message #42515] |
Mon, 14 February 2005 06:33  |
Sverre Solberg
Messages: 18 Registered: February 2005
|
Junior Member |
|
|
Perhaps I have done a very basic and stupid error in the program below,
or there's some very mysterious explanation.
The problem in a stripped version is simply to plot a contour plot on
top of another plot. As basic as that. However, the following code does
not show the contour fields (at least not on my screen):
loadct, 0
f = dist(100, 100)
pencolor = 0
background = !D.n_colors-1
y = findgen(100)
plot, y, color = pencolor, background = background
contour, f, /overplot, color = pencolor
The mysterious part is that when I add the line:
contour, f, color = pencolor, background = background, /nodata
anywhere *before* the plot command, it works perfectly ok.
What is wrong?
(IDL 5.5 for Unix)
Sverre
|
|
|
Re: strange things in CONTOUR [message #42516 is a reply to message #42515] |
Mon, 14 February 2005 08:05  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ben Tupper writes:
> The second thing is interesting because David says it works fine for him
> (presumably without specifying levels.) I believe that that is one of his
> rewards for being one with IDL - IDL simply intuits his desires.
Uh, yeah, I've noticed this, especially with iTools. :-)
Cheers,
David
P.S. Let's just say I've heard St. John's Wort is good for
those black thoughts.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: strange things in CONTOUR [message #42519 is a reply to message #42515] |
Mon, 14 February 2005 07:57  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Sverre Solberg wrote:
> Perhaps I have done a very basic and stupid error in the program below,
> or there's some very mysterious explanation.
>
> The problem in a stripped version is simply to plot a contour plot on
> top of another plot. As basic as that. However, the following code does
> not show the contour fields (at least not on my screen):
>
> loadct, 0
> f = dist(100, 100)
> pencolor = 0
> background = !D.n_colors-1
> y = findgen(100)
> plot, y, color = pencolor, background = background
> contour, f, /overplot, color = pencolor
>
> The mysterious part is that when I add the line:
> contour, f, color = pencolor, background = background, /nodata
> anywhere *before* the plot command, it works perfectly ok.
>
> What is wrong?
>
> (IDL 5.5 for Unix)
>
Hi,
I'm not sure what could be wrong but shall point out two things:
!D.N_COLORS is not necessarily the same thing as !D.Table_Size, in this case you
are using indexed coloring - so you should use !D.Table_Size
Using OVERPLOT requires you to specify the contour levels (LEVELS) or number of
levels (NLEVELS) according to the online help...
"You must explicitly specify either the values of the
contour levels or the number of levels (via the NLEVELS keyword)
when using this option, unless geographic mapping coordinates
are in effect."
The second thing is interesting because David says it works fine for him
(presumably without specifying levels.) I believe that that is one of his
rewards for being one with IDL - IDL simply intuits his desires.
Cheers,
Ben
|
|
|
Re: strange things in CONTOUR [message #42520 is a reply to message #42515] |
Mon, 14 February 2005 06:46  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Sverre Solberg writes:
> What is wrong?
>
> (IDL 5.5 for Unix)
I think you answered your own question. Works well here
on Windows. :-)
Cheers,
David
P.S. Let's just say back in the early 1970's (or whenever it was
IDL 5.5 was fashionable) the way color worked was changing
with every IDL version. This probably has something to do
with your problem. It doesn't seem to be a problem now.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|