plot - 在 Gnuplot 中是否可以在曲面图下的 xyplane 上绘制 2D 图?
问题描述
我正在尝试创建类似于这些图的内容:
我有表面图,现在我想把它放在下面分别绘制:
我尝试将 2D 图像绘制为曲面图中的二进制图,但每个像素都被解释为坐标系中的一个整体,这是不正确的,它最终会复制坐标轴和绘图标题等。好吧,gnuplot 的 xyplane 不一定位于 z=0,因此仅使用 splot 通常使用 z 值为 0 进行绘图也不能满足我的要求。
到目前为止,这些是我的绘图文件:
二维散点图:
set terminal png enhanced size 8000, 4800 truecolor font "arial,60"
set encoding utf8
set output outfile
set autoscale fix
set border lw 3
set style fill transparent solid 0.075 noborder
set style circle radius 0.03
set title plotTitle
plot sample1 u 1:2 w circles notitle,\
sample2 u 1:2 w circles notitle,\
$ContourTable w lines lw 6 lc rgb 'black' notitle,\
keyentry w circles fill solid 1.0 noborder lc 1 title "ω_1",\
keyentry w circles fill solid 1.0 noborder lc 2 title "ω_2"
曲面图:
set terminal png enhanced size 8000, 4800 truecolor font "arial,60"
set encoding utf8
set output outfile
set autoscale fix
set border lw 3
set title plotTitle
set isosamples 100
set pm3d at s explicit hidden3d
unset hidden3d
set palette model RGB define (1 "dark-violet", 2 "#009e73")
splot pdfFile u 1:2:3:4 w pm3d lc rgb "black"
解决方案
也许是这样的?也许需要适应您的数据并进一步微调。
代码:
### surface plot with contour
reset session
GaussW3D(x,y,x0,y0,A,FWHM) = A * exp(-(x-x0)**2/(2*(FWHM/(2*sqrt(2*log(2))))**2)) *\
exp(-(y-y0)**2/(2*(FWHM/(2*sqrt(2*log(2))))**2))
set samples 40
set isosamples 40
f(x,y) = GaussW3D(x,y,4,4,1,5) + GaussW3D(x,y,0,0,1.5,3)
set contour base
set cntrparam levels 10
set hidden3d
set xyplane at -2
set ztics 0.5
splot sample [-4:10][-7:10] '++' u 1:2:(f(x,y)) w l
### end of code
结果:
推荐阅读
- json - SQL Server 插入带有其他外部参数的 JSON 数据
- javascript - 在 HTML 中切换图像隐藏/可见
- android-studio - 如何配置 Android Studio 以识别带有 SystemApi 注释的方法
- javascript - 物化日期选择器仅在单击完成按钮时更新
- omnet++ - 构建venes_inet 失败
- java - 从 Java 中的字符串中过滤非 MySQL Latin1 字符
- sql - 包含重复项的多个字符串
- kubernetes - Apache Camel 与 Kubernetes
- python - Python按最后一个字母和扩展名选择文件
- php - 多个 PHP 标记中的一个 PHP 变量