1
votes

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.

I am trying the following:

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

Data is in the format:

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

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

1

1 Answers

0
votes

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.

Code:

# 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

Result:

enter image description here