将文件的绘图和函数的splot与gnuplot结合在一个图形中

将文件的绘图和函数的splot与gnuplot结合在一个图形中,plot,graph,gnuplot,Plot,Graph,Gnuplot,我想在一个图形中的函数的splot上绘制一条线的路径。 我的代码: 使用数据文件: 0.00000000e+000 0.00000000e+000 1.0000000 0.00000000e+000 -1.00000000e+000 2.0000000 -7.21690590e-002 -2.37121212e+000 4.0000000 到目前为止,我的解决方案是将两张tikz照片用乳胶混合在一起。但必须有一种更好的方法来避免图形边界的麻烦。有什么想法吗 提前问候并感谢您 我想

我想在一个图形中的函数的splot上绘制一条线的路径。 我的代码:

使用数据文件:

0.00000000e+000   0.00000000e+000  1.0000000
0.00000000e+000  -1.00000000e+000  2.0000000 
-7.21690590e-002 -2.37121212e+000  4.0000000
到目前为止,我的解决方案是将两张tikz照片用乳胶混合在一起。但必须有一种更好的方法来避免图形边界的麻烦。有什么想法吗


提前问候并感谢您

我想,这里的问题是带轮廓的
splot
和带圆的
plot
不能一起使用。 一种解决方案是将等高线数据绘制到表格中,然后使用一个
plot
命令将其一起绘制。 我已经重新整理或重写了你的代码。我想这应该接近你想要达到的目标,可以进一步调整。使用gnuplot 5.2.6和wxt终端创建以下输出

代码:

### plot contour data together with something else
reset session
unset key

set view map
set samples 80, 80
set isosamples 80, 80

set xr [x=-4:4]
set yr [y=-11:2]

potential(x,y) = 5*(x**2+y**2+8*x+6*y)**2+5*(x**2+y**2-6*x+8*y)**2+1000*y
set contour base
set cntrparam bspline
set cntrparam levels discrete 20000,10000,2500,0,-2500,-5000, -6000,-7000
unset surface

# write contour data to table
set table $Potential
    splot potential(x,y)
unset table

set xlabel "X" 
set ylabel "Y" 
set zlabel '{/Symbol P}' enhanced
set zlabel  offset character 7, 9, 0

set style textbox opaque margins  0.5,  0.5 fc  bgnd noborder linewidth  1.0

plot $Potential u 1:2 w l lc rgb "#888888",\
     '' every 100 w labels boxed  font ",6" notitle, \
     'MyData.dat' u 1:2:3 w circles lc rgb "#90EE90",\
     '' u 1:2:3 w lp lw 2 lc rgb "#000000"
### end of code
MyData.dat

0.00000000e+000   0.00000000e+000  1.0000000
0.00000000e+000  -1.00000000e+000  2.0000000 
-7.21690590e-002 -2.37121212e+000  4.0000000
结果:

### plot contour data together with something else
reset session
unset key

set view map
set samples 80, 80
set isosamples 80, 80

set xr [x=-4:4]
set yr [y=-11:2]

potential(x,y) = 5*(x**2+y**2+8*x+6*y)**2+5*(x**2+y**2-6*x+8*y)**2+1000*y
set contour base
set cntrparam bspline
set cntrparam levels discrete 20000,10000,2500,0,-2500,-5000, -6000,-7000
unset surface

# write contour data to table
set table $Potential
    splot potential(x,y)
unset table

set xlabel "X" 
set ylabel "Y" 
set zlabel '{/Symbol P}' enhanced
set zlabel  offset character 7, 9, 0

set style textbox opaque margins  0.5,  0.5 fc  bgnd noborder linewidth  1.0

plot $Potential u 1:2 w l lc rgb "#888888",\
     '' every 100 w labels boxed  font ",6" notitle, \
     'MyData.dat' u 1:2:3 w circles lc rgb "#90EE90",\
     '' u 1:2:3 w lp lw 2 lc rgb "#000000"
### end of code