在 gnuplot 中叠加向量、dgrid3d 和 pm3d 用于 3D 绘图 [英] Superimposing vectors, dgrid3d and pm3d in gnuplot for 3D plot

查看:40
本文介绍了在 gnuplot 中叠加向量、dgrid3d 和 pm3d 用于 3D 绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在叠加 dgrid3d、pm3d 和向量的 Gnuplot 中绘制一个向量场.我可以让 dgrid3d 和 pm3d 工作,但是当我尝试叠加向量时,奇怪的事情发生了.

I am trying to plot a vector field in Gnuplot superimposing dgrid3d, pm3d and vectors. I can get dgrid3d and pm3d to work but when I try to superimpose the vectors weird things happen.

我正在尝试以下操作:

set dgrid3d 50,50,2
set pm3d at b
set hidden3d
splot 'v-field.dat' u 1:2:6 w l, "" u 1:2:3:4:5:6 w vectors

数据格式为:

0.0000000020000000 0.0833272880000000 0 0 0 1.62609277247135e-09
0.5000000020000001 0.5833272880000000 0 0 0 0.965930741599645
0.8749688835000000 0.2083182225000000 0 0 0 0.233003475483508
0.3749688835000000 0.7083182225000000 0 0 0 0.732959928249388
0.7499740065000000 0.3333133385000000 0 0 0 0.612400228894737
0.2499740065000000 0.8333133384999999 0 0 0 0.353562980611359
0.6250021815000000 0.4583253445000000 0 0 0 0.915969987957243
0.1250021814999999 0.9583253445000000 0 0 0 0.0499605601370936
0.2500301575000000 0.0833358625000000 0 0 0 0.183035467628336
0.7500301575000000 0.5833358625000000 0 0 0 0.682946534409448
0.1250311175000000 0.2083182225000000 0 0 0 0.233003477250229

抱歉,如果之前有人问过这个问题,我是 gnuplot 的新手.

Sorry if this has been asked before, I am new to gnuplot.

推荐答案

我想问题是 set dgrid3d 和 plotting with vectors 在某种程度上不兼容.可能,gnuplot 也尝试为向量进行插值.一种解决方法是将您的内插网格表面绘制到一个数据块中,然后 unset dgrid3d.好吧,你的向量几乎不可见,当你旋转图形时,表面和基础的深度顺序仍然存在问题,我目前无法解决.

I guess the problem is that set dgrid3d and plotting with vectors are somehow not compatible. Probably, gnuplot tries to interpolate also for the vectors. A workaroud would be to plot your interpolated gridded surface into a datablock and then unset dgrid3d. Well, your vectors are hardly visible and when you rotate the graph there is still in issue with depthorder of the surface and the base which I couldn't resolve so far.

代码:

# combining dgrid3d and vectors
reset session

$Data <<EOD
0.0000000020000000 0.0833272880000000 0 0 0 1.62609277247135e-09
0.5000000020000001 0.5833272880000000 0 0 0 0.965930741599645
0.8749688835000000 0.2083182225000000 0 0 0 0.233003475483508
0.3749688835000000 0.7083182225000000 0 0 0 0.732959928249388
0.7499740065000000 0.3333133385000000 0 0 0 0.612400228894737
0.2499740065000000 0.8333133384999999 0 0 0 0.353562980611359
0.6250021815000000 0.4583253445000000 0 0 0 0.915969987957243
0.1250021814999999 0.9583253445000000 0 0 0 0.0499605601370936
0.2500301575000000 0.0833358625000000 0 0 0 0.183035467628336
0.7500301575000000 0.5833358625000000 0 0 0 0.682946534409448
0.1250311175000000 0.2083182225000000 0 0 0 0.233003477250229
EOD

set dgrid3d 30,30,2
set pm3d at b 
set hidden3d

set table $Surface
    splot $Data u 1:2:6
unset table

unset dgrid3d

splot $Surface u 1:2:3 w l , 
      $Data u 1:2:3:4:5:6 w vectors lw 2 lc rgb "red"
### end of code

结果:

这篇关于在 gnuplot 中叠加向量、dgrid3d 和 pm3d 用于 3D 绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆