简体   繁体   中英

Gnuplot - How to join smoothly ordered points?

I've a set of data in three columns:

    1st column: order criterion between 0 and 1
    2nd: x vals
    3rd: y vals

As a data file example:

0.027   -29.3   -29.6
0.071   -26.0   -31.0
0.202   -14.0   -32.8
0.304   -3.4    -29.3
0.329   -0.5    -26.0
0.409   6.7     -14.0
0.458   11.7    -3.4
0.471   12.8    -0.5
0.495   12.5    6.7
0.588   18.8    11.7
0.600   20.4    12.8
0.618   20.8    12.5
0.674   20.9    18.8
0.754   22.1    20.4
0.810   27.0    20.8
0.874   24.7    20.9
0.892   9.4     22.1
0.911   -11.5   27.0
0.943   -23.7   24.7
0.962   -29.6   9.4
0.991   -31.0   -11.5
0.999   -32.8   -23.7

My goal is to plot (x,y) points and a trend curve passing through each points ordered in ascending order with the first column values. I use the following script:

set terminal png small size 600,450
set output "my_data_mcsplines_joined_points.png"
set table "table_interpolation.dat"
plot 'my_data.dat' using 2:3 smooth mcsplines
unset table
plot 'my_data.dat' using 2:3:(sprintf("%'.3f", $1)) with labels point pt 7 offset char 1,1 notitle ,\
"table_interpolation.dat" with lines notitle

Here mcspline results as an example:

mcspline joined points figure

The resulting curve should have the shape of a spindle or a loop. Whatever smooth options used, Gnuplot seems invalid to handle such aim. Unfortunatly most of smooth (mcspline, csplines...) options do a monotonic ordering of data.

How can I plot a trend curve passing through each points ordered in ascending order with the first column values?

Thanks.

I cannot post an image in a comment, and so place it here. I don't think a 2D plot will be sufficient, based on this 3D acatterplot of the data in your question. 散点图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM