简体   繁体   English

mayavi mlab获取当前轴

[英]mayavi mlab get current axes

Is there a way of a procedure similar to plt.gca() to get a handle to the current axes. 有没有一种类似于plt.gca()来获取当前轴的句柄。 I first do a=mlab.surf(x, y, u2,warp_scale='auto') 我首先做a=mlab.surf(x, y, u2,warp_scale='auto')

and then 接着

b=mlab.plot3d(yy, yy, (yy-40)**2 ,tube_radius=20.0)

but the origin of a and b are different and the plot looks incorrect. 但是ab的原点不同,并且绘图看起来不正确。 So I want to put b into the axes of a 所以我想把b成轴a

In short, what would be the best way in mayavi to draw a surface and a line on same axes? 简而言之,在mayavi中最好的方法是在同一轴上绘制表面和直线吗?

What you are expecting to be able to do from your matplotlib experience is not how mayavi axes work. 根据matplotlib的经验,您期望做的不是mayavi轴如何工作。 In matplotlib the visualization is a child of the axes and the axes determines its coordinates. 在matplotlib中,可视化是轴的子级,并且轴确定其坐标。 In mayavi or vtk, visualization sources consist of points in space. 在mayavi或vtk中,可视化源由空间中的点组成。 Axes are objects that surround a source and provide tick markings of the coordinate extent of those objects, that are not necessary for the visualizations, and where they exist they are children of sources. 轴是围绕源的对象,并提供这些对象的坐标范围的刻度标记,这对于可视化来说不是必需的,并且在存在的位置,它们是源的子代。

You should remove the argument warp_scale='auto' 您应该删除参数warp_scale ='auto'

a=mlab.surf(x, y, u2)

and it will work. 它会工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM