具有等高线基础的 gnuplot pm3d

gnuplot pm3d with contour base

我想在该图的 z=0 平面中添加等高线:

为了获得与此类似的东西(从一本书中回收)

我如何使用 gnuplot 做到这一点?考虑生成 pm3d 图的代码如下:

set terminal pdfcairo enhanced font "palatino,42" fontscale 1.0 size 30, 22 background rgb 'white'
 set output 'stromegaJPDF_90.pdf'
#set border 4095 front lt black linewidth 1.000 dashtype solid
set style line 100  linecolor rgb "#f0e442"  linewidth 0.500 dashtype solid pointtype pointsize default
 #set view 50, 220, 1, 1
set samples 30, 30
set isosamples 30, 30
set surface
set title "Re=90"
 set cbrange [ * : * ] noreverse writeback
 set rrange [ * : * ] noreverse writeback
 set pm3d implicit at s
 set pm3d depthorder
 set pm3d interpolate 1,1 flush begin noftriangles border linecolor rgb "gray"  linewidth 1.000 dashtype solid corners2color mean
 set xrange[0:15]
  set logscale z
  set xlabel '{/Symbol w}^2/<{/Symbol w}^2>' enhanced
  set ylabel 'cos({/Symbol w}, W)' enhanced
   splot 'jpdfstrW_90.dat' t 'JPDF'

jpdfsrtW_90.dat 此处报 enter link description here

您必须在网格结构中拥有数据,即每个块中的条目数相等(例如,在您的情况下为 100),但在您的第一个和最后一个块中,您的条目数少于一般情况。 After fixing it,它应该通过添加 set contour both 来工作。在对数刻度上,您不能期望显示 z=0,并且您还需要解决恰好 z=0 值的问题以获得合适的视图。

对于简化的绘图文件,请考虑以下示例:

set contour both
set pm3d border linewidth 0.2

set logscale z
set zrange [1e-5:]

splot 'jpdfstrW_90.dat' u 1:2:(+1e-5) w pm3d t 'JPDF'

要使等高线更粗,请仅使用等高线重新绘制数据:

splot 'jpdfstrW_90.dat' u 1:2:(+1e-5) w pm3d t 'JPDF', "" u 1:2:(+1e-5) t 'JPDF' with lines nosurf lw 2

后者产生:

根据科学原理进一步customize contour lines, you need to define the lines manually. To customize the counter levels, check out cntrparam. If log z is used, maybe it is more natural to use a logarithmic color bar too. You could also try different color palettes

考虑以下用于自定义轮廓线的脚本:

set contour both
set pm3d border linewidth 0.2

set linetype 1 lc rgb "black" lw 1.5 dt 1
set linetype 2 lc rgb "black" dt 1
set linetype 3 lc rgb "black" dashtype 2
set linetype 4 lc rgb "black" dashtype 3
set linetype 5 lc rgb "black" dashtype 4
set style line 1 lc rgb 'black' lw 1.5 dt 1
set style line 2 lc rgb 'black' dt 1
set style line 3 lc rgb 'black' dashtype 2
set style line 4 lc rgb 'black' dashtype 3
set style line 5 lc rgb 'black' dashtype 4

set logscale z
set zrange [1e-5:]
set log cb
set cntrparam levels discrete 1, 0.1, 0.002, 0.0005
splot 'jpdfstrW_90.dat' u 1:2:(+1e-5) w pm3d notitle, "" u 1:2:(+1e-5) t 'JPDF' with lines nosurf