gnuplot - smooth interpolation x=f(y)

廉价感情. 提交于 2019-12-23 10:08:39

问题


I would like to plot a 2D graph with csplines interpolation of my data with an independent variable on y axis. The interpolating function should be in x = f(y) form. Is there any way to do this without switching axes?

gnuplot:

set terminal svg size 400,300 enhanced fname 'arial'  fsize 10 butt solid
set output 'out.svg'
set xrange [10:13]
plot "data.txt" using 2:1 notitle #smooth csplines

Data:

1 11.45294118
2 11.43529412
3 11.18823529
4 10.98235294
5 10.94117647
6 11.28823529
7 11.27058824

回答1:


You can use a table as an intermediate file and do the interpolation in the usual way:

set table "data2.txt"
plot "data.txt" using 1:2 notitle smooth csplines
unset table
set xrange [10:13]
plot "data2.txt" using 2:1 w l notitle

If you want higher resolution you can use set samples before plotting to the table.



来源:https://stackoverflow.com/questions/25526542/gnuplot-smooth-interpolation-x-fy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!