就像绘图时可使把matplotlib嵌入jupyter中一样,mayavi也在jupyter notebook中嵌入式使用。

以下假定已经安装好了jupyter notebook和mayavi库。

1. 安装需要的python依赖

pip install ipywidgets ipyevents

2. 进行设置

命令行中输入以下命令即可:

$ jupyter nbextension install --py mayavi --user
$ jupyter nbextension enable --py mayavi --user

3. 开始使用

打开jupyter notebook,在正式开始使用mayavi绘图前,调用mayavi.mlab.init_notebook()函数即可。

from mayavi import mlab
mlab.init_notebook()

此后,mlab绘制出来的三维图即可内嵌于jupyter之中了。这样嵌在jupyter中的三维图也是可以用鼠标对其进行拖动旋转等操作的哦~

jupyter notebook中使用mayavi三维绘图库

相关文章:

  • 2021-06-04
  • 2021-05-23
  • 2021-05-10
  • 2021-08-19
  • 2021-11-19
  • 2021-05-07
  • 2021-12-21
猜你喜欢
  • 2021-05-22
  • 2021-12-18
  • 2021-07-07
  • 2022-12-23
  • 2021-11-10
  • 2021-10-13
相关资源
相似解决方案