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

Home » Public Forums » archive » Re: Smooth Contour Plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Smooth Contour Plot [message #78160] Tue, 01 November 2011 05:17 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Sofie Fehlmann writes:

> I have just started using IDL and have now a question:
>
> How can plot smooth 2d Plots? I have tried the following:
>
> c1 = contour(data,x,y,rgb_table=34,/fill,n_levels=55)
>
> The result is a 2D plot which looks like a surrealistic picture of
> art. If I use the function min_curve_surf(data), the program crashes.
> If I increase the number of levels, the result looks even worse.
>
> Is there a way to create a colored 2D plot with smooth color
> variations?

The secret to producing smooth contour plots is
to start with smoothly varying data. If your
data is not smoothly varying, you have two
choices. You can get used to disappointment
(the usual solution), or you can try to smooth
it (the SMOOTH function is a likely candidate).

If you choose to smooth it, you are going to
have to come up with compelling arguments about
why you think changing your data and creating
numbers that don't exist in the data is justified.
"Because it looks better" doesn't usually cut
much ice with the folks who judge these things. :-)

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: Smooth Contour Plot [message #78255 is a reply to message #78160] Tue, 01 November 2011 07:59 Go to previous message
Sofie Fehlmann is currently offline  Sofie Fehlmann
Messages: 5
Registered: November 2011
Junior Member
I finally found the solution.

Maybe I didn't state the problem very well. I have a matrix with data
points. What I wanted to do is the following: Each point should have a
certain color such that I get a smooth picture. Somehow, when I
changed the number of levels (n_levels), the color scheme just started
from the beginning.

The following pattern worked finally:

levels = 256
step = (Max(data) - Min(data)) / levels
userLevels = IndGen(levels) * step + Min(data)

contour(data,x,y,rgb_table=33,/
fill,c_value=userlevels,c_color=indgen(levels)+1)

Doing so, I have created an array of data-steps. Further, the c_color
command defines the corresponding color.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: wavelength calibration
Next Topic: Smooth Contour Plot

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

Current Time: Wed Oct 08 13:46:57 PDT 2025

Total time taken to generate the page: 0.00494 seconds