在gnuplot中叠加3D图的向量dgrid3d和pm3d
我正在尝试在Gnuplot中绘制矢量场,将dgrid3d,pm3d和矢量叠加在一起.我可以使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
和用矢量绘制
是不兼容的.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
结果: