Smooth Contour Plot [message #78162] |
Tue, 01 November 2011 03:24  |
Sofie Fehlmann
Messages: 5 Registered: November 2011
|
Junior Member |
|
|
Dear all,
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?
|
|
|
Re: Smooth Contour Plot [message #78254 is a reply to message #78162] |
Tue, 01 November 2011 08:16  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Sofie Fehlmann writes:
> 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.
Ah, yes, that will smooth things out. Of course, so
will displaying your data as an image. ;-)
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.")
|
|
|