mayavi

Implicit equation and Mayavi

对着背影说爱祢 提交于 2020-01-13 16:31:40
问题 How to plot implicit equation F(x,y,z)=0 with Mayavi? I tried with import scipy as np x, y, z = np.mgrid[-3:3:100j, -3:3:100j, -3:3:100j] F = x**2/3**2 + y**2/2**2 + z**2/4**2 - 1 from enthought.mayavi import mlab mlab.contour3d(F) mlab.show() but I don't get a part of ellipsoid. If I use parametrization and mesh then it's ok, but don't know how to plot it implicitly. 回答1: Use contours = [0] to get the surface F(x,y,z) = 0 : import numpy as np from enthought.mayavi import mlab x, y, z = np

Does Mayavi “Font Size” text property work?

≡放荡痞女 提交于 2020-01-11 08:44:11
问题 Is there a bug in the Mayavi font rendering that prevents changing the font size? I am using the Mayavi2 GUI to change the font size of the axis labels on a volumetric plot. To get there I go to: Scene -> Scalar Field -> Colors and Legends -> Axes -> Label Text (tab) -> Font Size Changing this number does not affect the size of the fonts in the image. Is this a known bug? I have seen no reference to it on Google. How do you change the text size on your mayavi figures? 回答1: I've just

How to load a CSV file from the Mayavi GUI?

烂漫一生 提交于 2020-01-11 06:49:32
问题 I know how to read the CSV into numpy and do it from a Python script, and that is good enough for my use case. But since it has a GUI with data loading functionality, I was expecting it would just work for such an universal data format. So I tried to go on the menu: File Load data Open file but when I select a simple CSV file: i=0; while [ "$i" -lt 10 ]; do echo "$i,$((2*i)),$((4*i))"; i=$((i+1)); done > main.csv which contains: 0,0,0 1,2,4 2,4,8 3,6,12 4,8,16 5,10,20 6,12,24 7,14,28 8,16,32

Mayavi: animating an octahedron outline without blocking

て烟熏妆下的殇ゞ 提交于 2020-01-03 05:34:50
问题 I am trying to animate an octahedron. Here is the code for that. A simpler version of this code would be found on this different question on SO. Using the code there and the style of the animate object as used here I tried to make a functional animation. The only problem is- the animation hangs up the plot window! import numpy as np import mayavi.mlab as ML import math import time def produce_verts(A,t): delta=lambda A,t:A*math.sin(t) verts =lambda d: [(1+d,0,0), (0,1+d,0), (-1-d,0,0), (0,-1

Bad automatic Triangulation with Mayavi for coloring a surface known only by its corner

梦想的初衷 提交于 2020-01-03 03:13:13
问题 I trying to color a surface known only by its corner according to its Y value with Mayavi. Original, I I succeed in making the same thing with matplotlib (here) but I put back this canonical on my real data, the rendering was not sufficient and therefore I am trying now with Mayavi. I found the example from Surface from irregular data example which is quite helpful. However when applied to my case, reproduce here on this simple case, the triangulation gets wrong as seen on the figure below

How to visualize 3D delaunay triangulation in Python?

假装没事ソ 提交于 2020-01-02 05:45:32
问题 I have a set of 3D points which I've used scipy.spatial.Delaunay to do the triangulation / tetrahedralization. I now have a set of unique faces of all of the tetrahedra, and would like to visualize these in 3D. Are there any Python libraries (or libraries with a Python wrapper) that can do this? 回答1: Try mayavi.mlab.triangular_mesh() import numpy as np from mayavi import mlab vertices = np.array([[0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]]) faces = np.array([[0, 1, 0, 0],[1, 2, 1, 2],[2, 3, 3, 3]

Save data to VTK using Python and tvtk with more than one vector field

感情迁移 提交于 2020-01-02 05:24:08
问题 I'm trying to save three sets of vector quantities corresponding to the same structured grid (velocity, turbulence intensity and standard deviation of velocity fluctuations). Ideally, I'd like them to be a part of the same vtk file but so far I have only been able to get one of them into the file like so: sg = tvtk.StructuredGrid(dimensions=x.shape, points=pts) sg.point_data.vectors = U sg.point_data.vectors.name = 'U' write_data(sg, 'vtktestWake.vtk') I've spent past few hours searching for

Is it possible to directly apply an affine transformation matrix to a Mayavi ImageActor object?

不羁岁月 提交于 2020-01-02 00:58:10
问题 I'm using Mayavi to render some imaging data that consists of multiple 2D planes within a 3D volume, the position, orientation and scale of which are defined by 4x4 rigid body affine transformation matrices. Each plane consists of: An array of 2D image data, which I display using mayavi.mlab.imshow A set of ROIs consisting of lines and points that I draw using mayavi.mlab.points3d and mayavi.mlab.plot3d respectively. I transform my points and line vertices from a 2D reference plane into the

Adding a 4th variable to a 3D plot in Python

时光毁灭记忆、已成空白 提交于 2019-12-30 16:28:31
问题 I have 3 different parameters X,Y and Z over a range of values, and for each combination of these a certain value of V. To make it clearer, the data would look something like this. X Y Z V 1 1 2 10 1 2 3 15 etc... I'd like to visualize the data with a surface/contour plot, using V as a colour to see its value at that point, but I do not see how to add my custom colouring scheme into the mix using Python. Any idea on how to do this (or is this visualization outright silly)? Thanks a lot! 回答1:

Enthought Canopy Mayavi font size bug

Deadly 提交于 2019-12-29 08:43:07
问题 The font size setting in Enthough Canopy Mayavi mlab appears to be broken. Neither the command: mlab.axes.label_text_property.font_size = 12 (e.g.) nor the direct menu font size command (advanced settings) works. I have logged a bug report with Enthought, but it looks like a more general Mayavi bug, see Does Mayavi "Font Size" text property work? 回答1: As you say this is a bug that has to do with the translation between the mayavi layer and the vtk layer. But for now you could use this