[英]Multiple Plots in Mayavi
MATLAB has a hold
function (if I remember correctly, it's been a while) to plot several things on the same "graph"/window. MATLAB有一个
hold
功能(如果我没记错的话,已经有一段时间了)在同一个“图形”/窗口上绘制几个东西。 Is there anyway to do this in Mayavi? 无论如何在Mayavi有这样的事吗? I'd like to visualize several realizations of a calculation, and have them all on the same graph.
我想要想象一下计算的几个实现,并将它们全部放在同一个图表上。 But I haven't been able to figure it out from reading the documentation.
但是我无法通过阅读文档来解决这个问题。
If you are using the mlab module of mayavi, it will hold by default. 如果您正在使用mayavi的mlab模块,它将默认保留。 Example:
例:
In [1]: from mayavi import mlab
In [2]: import numpy as np
In [3]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[3]: <mayavi.modules.surface.Surface at 0x2a4eade0>
In [4]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[4]: <mayavi.modules.surface.Surface at 0x28218ab0>
In [5]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[5]: <mayavi.modules.surface.Surface at 0x2a51db40>
In [6]: mlab.plot3d(np.random.rand(10), np.random.rand(10), np.random.rand(10))
Out[6]: <mayavi.modules.surface.Surface at 0x2a840bd0>
The three plots will be in the same figure. 这三个地块将在同一图中。
If you create a new figure, the new ones will be added to this new figure. 如果您创建一个新图形,新图形将添加到此新图形中。 You can also directly assign a new plot to a given figure with the
figure
keyword argument. 您还可以使用
figure
关键字参数直接将新绘图分配给给定的图形。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.