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
|
|
|