如何在 MayaVi 中绘制正确的 3D 轴,例如在 Matplotlib 中找到的轴 [英] How to plot proper 3D axes in MayaVi, like those found in Matplotlib

查看:58
本文介绍了如何在 MayaVi 中绘制正确的 3D 轴,例如在 Matplotlib 中找到的轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在 MayaVi 中的 3D 曲面图上设置正确的轴.我能创建的最好的轴看起来像 ...

这些轴看起来比默认的 MayaVi 轴更专业,也更容易阅读.

任何帮助将不胜感激.

谢谢!

解决方案

我也遇到了这个问题.我通过不显示 mayavi 轴,而是使用 plot3d() 绘制我自己需要的轴来破解一个糟糕的解决方法

from mayavi import mlab将 numpy 导入为 npxx = yy = zz = np.arange(-0.6,0.7,0.1)xy = xz = yx = yz = zx = zy = np.zeros_like(xx)mlab.plot3d(yx,yy+lensoffset,yz,line_width=0.01,tube_radius=0.01)mlab.plot3d(zx,zy+lensoffset,zz,line_width=0.01,tube_radius=0.01)mlab.plot3d(xx,xy+lensoffset,xz,line_width=0.01,tube_radius=0.01)

您现在可以使用 text3d() 添加标签和注释非常不优雅和蛮力,但在紧要关头工作.

I would like to know how to have proper axes on a 3D surface plot in MayaVi. The best axes I could create looked something like this...

However, these do not look very professional if I were to give a presentation or put these on a poster.

I would like the axes to look something like this...

These axes look much more professional and are easier to read than the default MayaVi axes.

Any help would be greatly appreciated.

Thanks!

解决方案

I had this problem too. I hacked a bad workaround by not displaying the mayavi axes, but plotting the axes I needed myself using plot3d()

from mayavi import mlab
import numpy as np
xx = yy = zz = np.arange(-0.6,0.7,0.1)
xy = xz = yx = yz = zx = zy = np.zeros_like(xx)    
mlab.plot3d(yx,yy+lensoffset,yz,line_width=0.01,tube_radius=0.01)
mlab.plot3d(zx,zy+lensoffset,zz,line_width=0.01,tube_radius=0.01)
mlab.plot3d(xx,xy+lensoffset,xz,line_width=0.01,tube_radius=0.01)

You can now add labels and annotations using text3d() Very inelegant and brute force, but works in a pinch.

这篇关于如何在 MayaVi 中绘制正确的 3D 轴,例如在 Matplotlib 中找到的轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆