Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Contour interpolated plot from scattered data

218 views
Skip to first unread message

ronsne...@gmail.com

unread,
Mar 19, 2015, 5:32:33 PM3/19/15
to
How do you do a color contour plot (map view) with interpolation between values from a data set when the values don't follow a consistent matrix? The x axis is time (a date), the y axis is water depth (e.g., 0-20 meters), and the z value is water temperature (0-30C).

The data is scattered enough that it cannot be put into a matrix usable by pm3d (AFAIK). This is because the time values are not always consistently spaced and may have large gaps in them and there are some missing values here and there for water temperatures at various depths.

Thanks much for any insight you can provide!

Ron

Karl

unread,
Mar 19, 2015, 5:55:57 PM3/19/15
to
Have you tried "set dgrid3d"? I also has several options to control the
interpolation algorithm.

Karl

ronsne...@gmail.com

unread,
Mar 19, 2015, 6:05:23 PM3/19/15
to
No I hadn't. But I see now that that may be what I was missing. I'll keep working on it. Thanks!

ronsne...@gmail.com

unread,
Mar 19, 2015, 6:40:52 PM3/19/15
to
OK, yes I have this working now!! Thanks for the quick response.

Ron

ronsne...@gmail.com

unread,
Mar 19, 2015, 9:15:06 PM3/19/15
to
Scratch that. The dgrid3d interpolation will change the values themselves--not the missing values between the values which is what I need.

ronsne...@gmail.com

unread,
Mar 19, 2015, 10:01:23 PM3/19/15
to
Here's my best attempt. To simplify setting this up, I'm not using time data but a simple x value and some test data values. If I do a simple plot:

splot "test.dat" notitle

This looks fine. But when I try to make this a color image, I can't get accurate results:

splot "test.dat" using 1:2:3 with image notitle

Here's my best attempt:

set xrange [0:10]
set yrange [130:100]
set xlabel "July"
set ylabel "Depth (m)"
set cblabel "Temperature (C)"
set cbrange [0:30]

set view map
set hidden3d
splot "test.dat" using 1:2:3 with image notitle

And this is the test.dat file (indented for clarity):

1.5 110 30
1.5 120 30
2.5 110 30
2.5 120 30
3.5 110 30
3.5 120 30
4.5 110 30
4.5 120 30
5.5 110 30
5.5 120 30
6.0 110 25
6.0 120 30
6.25 110 20
6.25 120 30
6.5 110 15
6.5 120 30
6.75 110 10
6.75 120 30
7.5 110 0
7.5 120 30
8.5 110 0
8.5 120 30
9.5 110 0
9.5 120 30

Let me know if anyone has done this and how you did it.

Thanks,
Ron

Karl

unread,
Mar 20, 2015, 3:47:09 AM3/20/15
to
The 2D plot "with image" seemingly ignores dgrid3d mode.

How about this?

(gnuplot 5.0 syntax, for older versions you have to plot the table to a
temporary file instead of "$interpol")

set dgrid3d 20,30
set table $interpol
splot dataf using 1:2:3
unset table

plot $interpol using 1:2:3 with image



ronsne...@gmail.com

unread,
Mar 23, 2015, 12:04:25 PM3/23/15
to
Thanks, but dgrid3d doesn't do the type of interpolation that is needed. I still haven't found a solution.

0 new messages