gnuplot:交互式3D动画?

时间:2019-04-05 22:48:02

标签: animation 3d gnuplot interactive

使用gnuplot,您可以使用splot创建类似3D的绘图,并以交互方式更改视图。 enter image description here

您还可以使用set terminal gif animate用gnuplot创建动画。

enter image description here

### interactive animation?
reset session
set view equal
set border 0
unset tics

$Data <<EOD
1   1.000   0.000   0.000
2   0.500   0.866   0.000
3   -0.500  0.866   0.000
4   -1.000  0.000   0.000
5   -0.500  -0.866  0.000
6   0.500   -0.866  0.000
1   1.000   0.000   0.000
EOD

$Off <<EOD
1   0.00    0.00    0.1
2   0.00    0.00    -0.1
3   0.00    0.00    0.1
4   0.00    0.00    -0.1
5   0.00    0.00    0.1
6   0.00    0.00    -0.1
1   0.00    0.00    0.1
EOD

set xrange[-2:2]
set yrange[-2:2]
set zrange[-2:2]
set view 45,45
max=10.
Offset(n,axis,i) = real(word($Off[n+1],axis+1))*sin(2*pi*i/max)

set term gif animate delay 5 size 400,300
set output "Molecule.gif"

do for [i=0:max] {
    splot $Data u ($2+Offset($0,1,i)):($3+Offset($0,2,i)):($4+Offset($0,3,i)) \
    w lp pt 7 ps 2 lw 2 lc rgb "red" not
    unset autoscale
}

set term wxt size 400,300
set margin 0
splot $Data u 2:3:4 w lp pt 7 ps 2 lw 2 lc rgb "red" not
set output
### end of code

现在,我的问题是:也许还有机会制作交互式动画吗?我想旋转动画时的视图。 gnuplot是否有可能?有什么想法吗?

编辑:

@Ethan的答案解决了这个问题。但是,也许有一种方法可以避免鼠标光标闪烁?

enter image description here

1 个答案:

答案 0 :(得分:2)

将plot命令放入循环中不会禁用鼠标交互。简单的答案应该起作用:

def test_create_person(self, client, mocker):
        PersonFactory.build()

        serializer = mocker.patch.object(PersonSerializer, 'save')

        view = PersonCreate()
        PersonCreate.perform_create(view, serializer)

        serializer.save.assert_called_once()