mayavi

How to remove Mayavi toolbar in python using code

≯℡__Kan透↙ 提交于 2019-12-01 11:15:22
问题 I have several Mayavi plots that I am combining in a single window (along the lines of the documentation), and it would be much better if I could get rid of the toolbars in all of them. While it's possible to to right-click each of the toolbars to have them disappear, I would like to code them to disappear instead. A command like scene.hide_toolbar() would be ideal. I've dug around in the TraitsUI package a bit to no avail... anybody know how to make it go away? 回答1: You can use Handler to

How to load a CSV file from the Mayavi GUI?

痴心易碎 提交于 2019-12-01 10:11:35
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 9,18,36 an error popup shows on the GUI: No suitable reader found for file /home/ciro/main.csv Google

How to directly set RGB/RGBA colors in mayavi

房东的猫 提交于 2019-12-01 10:03:36
问题 I have a mayavi object with a number of vertices and I would like to set RGB or RGBA values directly for these vertices, rather than restrict myself to a single colormap with scalars. How can this be accomplished? 回答1: As far as I am aware, there is no documentation for doing this, but I have found a way to do it with only a minimum amount of hacking around. Here is a minimal example, which might require a little tinkering for different kinds of sources: from tvtk.api import tvtk; from mayavi

Mayavi points3d with different size and colors

北城以北 提交于 2019-12-01 02:45:39
Is it possible in mayavi to specify individually both the size and the colors of every point? That API is cumbersome to me. points3d(x, y, z...) points3d(x, y, z, s, ...) points3d(x, y, z, f, ...) x, y and z are numpy arrays, or lists, all of the same shape, giving the positions of the points. If only 3 arrays x, y, z are given, all the points are drawn with the same size and color. In addition, you can pass a fourth array s of the same shape as x, y, and z giving an associated scalar value for each point, or a function f(x, y, z) returning the scalar value. This scalar value can be used to

mayavi texture to span over full surface

旧街凉风 提交于 2019-12-01 00:49:31
I want to do something similar to: 3D terrain visualization with python and Mayavi2 As input I have an image (map) with a defined width and height in pixel. For this image / map I get the digital elevation model of the surface the image / map represents (extent). The extent consists of the min / max longitude and latitude values. For the elevation model I interpolate a grid with the same amount of values as the pixel of the image. im # PIL Image object pixel_x, pixel_y = im.size ext = [lon_min, lon_max, lat_min, lat_max] xstep = float(ext[1] - ext[0]) / float(pixel_x) ystep = float(ext[3] -

mayavi mlab.savefig() gives an empty image

江枫思渺然 提交于 2019-11-30 21:17:18
I am trying to learn mayavi2 for python and can not get my savefig to show my plots. I found this example code: from numpy import pi, sin, cos, mgrid dphi, dtheta = pi/250.0, pi/250.0 [phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta] m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4; r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7 x = r*sin(phi)*cos(theta) y = r*cos(phi) z = r*sin(phi)*sin(theta) # View it. from mayavi import mlab a= mlab.mesh(x, y, z) mlab.show() Now I want to save the figure, so I add: mlab.savefig(filename='test.png'

mayavi mlab.savefig() gives an empty image

一世执手 提交于 2019-11-30 17:11:28
问题 I am trying to learn mayavi2 for python and can not get my savefig to show my plots. I found this example code: from numpy import pi, sin, cos, mgrid dphi, dtheta = pi/250.0, pi/250.0 [phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta] m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4; r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7 x = r*sin(phi)*cos(theta) y = r*cos(phi) z = r*sin(phi)*sin(theta) # View it. from mayavi import mlab a=

How do I scale the x and y axes in mayavi2?

泪湿孤枕 提交于 2019-11-30 16:57:14
问题 I want to do a 3-d plot with mayavi2 using mayavi.mlab.surf(). This function has an argument called warp_scale that can be used to scale the z axis, I'm looking for something similar but for the x and y axes. I can do this manually by multiplying the x and y arrays and then using the ranges argument in mayavi.mlab.axes() to correct the axes labels, however I'm looking for a more direct approach like that of warp_scale. Thanks! 回答1: when "m" is your surface object: m.actor.actor.scale = (0.1,

ValueError: cannot set toolkit to wx because it has already been set to qt4

前提是你 提交于 2019-11-30 14:12:21
问题 The following import from mayavi import mlab generates the value error. I installed Mayavi using setuptools (as described here). The gui works fine (some bugs here and there but still I can use the modules etc.) I am guessing some thing didn't went well with the install. Any suggestions how I can fix my installation(if that is what the problem is) ? Edit 1: I uninstalled mayavi and reinstalled it (using pip), but the valueError is still present. Edit 2: The system I have the installation on

How do I scale the x and y axes in mayavi2?

一曲冷凌霜 提交于 2019-11-30 13:27:36
I want to do a 3-d plot with mayavi2 using mayavi.mlab.surf(). This function has an argument called warp_scale that can be used to scale the z axis, I'm looking for something similar but for the x and y axes. I can do this manually by multiplying the x and y arrays and then using the ranges argument in mayavi.mlab.axes() to correct the axes labels, however I'm looking for a more direct approach like that of warp_scale. Thanks! when "m" is your surface object: m.actor.actor.scale = (0.1, 1.0, 1.0) http://osdir.com/ml/python.enthought.devel/2006-11/msg00067.html I was looking for the same