【问题标题】:how to plot new line given by math formula over pm3d map如何在pm3d地图上绘制数学公式给出的新线
【发布时间】:2017-10-10 13:44:52
【问题描述】:

环境

gnuplot 5.0 补丁级别 1

How to plot discrete points on top of pm3d map in gnuplot?, 带有代码和他的迷你数据

set term postscript enhanced color
set output "gc4-4.eps"
set pm3d map interpolate 10,10
set palette rgbformulae 22,13,-31
sp 'file.dat', 'points.dat' using 1:2:(0) with lines

Draw a line in a pm3d mapHow to mark some points on 2D heat map in gnuplot? 是类似的解决方案。但是他们使用数据文件而不是数学公式。

我也试过How to overlay dots/points scatter plot onto a pm3d map/surfaceHow to overlay contour plot over pm3d map/surfaceHow do I plot lines (not grids) using splot?

尝试一些未设置表面、显式设置表面、绘图...无表面的组合。 . 这些似乎是 3d 协调的解决方案。

我仍然没有得到预期的结果。

我错过了什么吗?提前谢谢你。

我的代码如下:

set term postscript enhanced color
set output "g.eps"
set multiplot layout 1,2 
set pm3d map explicit interpolate 10,10
set palette rgbformulae 22,13,-31
#set contour
#set cntrparam levels incr 0,0.1,0.1
#set linetype 2 linecolor rgb "white" linewidth 2
set tics scale 0.5 
set label 1 '(a)' at graph -0.3,1 front
set xlabel "x" 
set ylabel "{/Symbol y}" 
set xtics 0.8,1.0,2.8
set xrange [0.8:2.8]
set ytics 0.1,0.1,0.9
set yrange [0.1:0.9]
set size 0.4,0.4
#unset surface
#set surface explicit
fx(x) = (x-1.8)**2+0.1
sp "s.data" u 1:2:3 with pm3d notit, fx(x) with line linetype 2 linecolor rgb "white" linewidth 2 tit "line"
#plot fx(x) with lines linetype 2 linecolor rgb "black" linewidth 2 tit "line"
plot fx(x) with lines linetype 2 linecolor rgb "black" linewidth 2 tit "line"
set label 1 '(b)' at graph -0.3,1 front
set xlabel "x"
set ylabel "{/Symbol y}"
set xtics 0.1,0.1,0.9
set xrange [0.1:0.9]
set ytics 0.8,1.0,2.8
set yrange [0.8:2.8]
set size 0.4,0.4
unset surface
set surface explicit
fx(x) = -(2*x-1)**2+1.8
sp "s.data" u 2:1:3 notit, fx(x) with lines linetype 2 linecolor rgb "white" linewidth 2 nosurface tit "line"
#plot fx(x) with lines linetype 2 linecolor rgb "black" linewidth 2 tit "line"
#sp "data/s2.data" u 2:1:3  notit

我的s.data的迷你数据:

# x y z
0.8 0.1 0.3 
0.8 0.2 0.2 
0.8 0.3 0.1 
0.8 0.4 0
0.8 0.5 0
0.8 0.6 0
0.8 0.7 0
0.8 0.8 0
0.8 0.9 0

1.8 0.1 0.3 
1.8 0.2 0.2 
1.8 0.3 0.1 
1.8 0.4 0.2 
1.8 0.5 0.3 
1.8 0.6 0.4 
1.8 0.7 0.4 
1.8 0.8 0.5 
1.8 0.9 0.5 

2.8 0.1 0.3 
2.8 0.2 0.4 
2.8 0.3 0.5
2.8 0.4 0.5
2.8 0.5 0.6
2.8 0.6 0.6
2.8 0.7 0.6
2.8 0.8 0.7
2.8 0.9 0.7

#

【问题讨论】:

  • 这个答案能解决你的问题吗?任何形式的回应都将不胜感激。

标签: gnuplot


【解决方案1】:

如果您知道如何在 pm3d 地图上绘制数据文件,那么您可以使用table 命令将函数绘制到数据文件中:

set table "temp_f.dat"
set samples 1000
fx(x) = (2*x-1)**2+1.8
plot fx(x)
unset table

set pm3d map explicit interpolate 10,10
set xrange [0.1:0.9]
set yrange [0.8:2.8]
splot "s.data" u 2:1:3, "temp_f.dat" u 1:2:(0) notitle with lines lw 2 lc 0

这是结果:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多