mayavi

How can I render 3D histograms in python?

…衆ロ難τιáo~ 提交于 2019-12-03 17:02:19
问题 I want to make plots like these from Hacker's Delight: What ways are there to accomplish this in Python? A solution that makes it easy to interactively adjust the graph (changing the slice of X/Y currently being observed) would be ideal. Neither matplotlib nor the mplot3d module have this functionality AFAICT. I found mayavi2 but it's extremely clunky (I can't even find the option for adjusting the sizes) and only seems to work correctly when run from ipython. Alternatively gnuplot could work

How to display a volume with non-cubic voxels correctly in mayavi

别来无恙 提交于 2019-12-03 13:09:51
I'm using mayavi (3.3.2) to display volume isosurfaces. Generally, my volumes do not have cubic voxels; for example, the sampling grid might be 1mm x 1mm in X and Y, but 1.4mm in the Z direction. How can I get such volumes to display with the correct spatial proportions using mayavi's mlab.contour3d or mlab.pipeline.iso_surface ? I'd really prefer to not resample the volumes to a cubic grid. Another way of stating the problem: what can I do to get the below code to display a sphere instead of a flattened elipsoid (taking the volume with it's intended 1:1:2 aspect-ratio voxels as a given, and

Phong shading for shiny Python 3D surface plots

。_饼干妹妹 提交于 2019-12-03 12:12:34
I'm trying to create aesthetically pleasing 3D plots in Python with specular shading, and thus far have tried using both Matplotlib with 3D axes and surface plots from Mayavi, e.g., from the Mayavi surf examples web page: The results look good, and in Mayavi there does seem to be reasonable control of the lighting, although I can't seem to achieve a "shiny" appearance. In Matlab, this can be achieved by using 'Phong' lighting: see http://www.mathworks.com/matlabcentral/fileexchange/35240-matlab-plot-gallery-change-lighting-to-phong/content/html/Lighting_Phong.html Therefore, my question is:

How to plot proper 3D axes in MayaVi, like those found in Matplotlib

笑着哭i 提交于 2019-12-03 11:53:52
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

3D Contour plot from data using Mayavi / Python

醉酒当歌 提交于 2019-12-03 03:21:16
问题 I would like to do a 3D contour plot using Mayavi in exactly the same way as the third figure on this page (a hydrogen electron cloud model) : http://www.sethanil.com/python-for-reseach/5 I have a set of data points which I created using my own model which I would like to use. The data points are stored in a multi-dimensional numpy array like so: XYZV = [[1, 2, 3, 4], [6, 7, 8, 9], ... [4, 5, 6, 7]] The data points are not uniformly spread in XYZ space and not stored in any particular order.

3D Contour plot from data using Mayavi / Python

十年热恋 提交于 2019-12-02 17:48:06
I would like to do a 3D contour plot using Mayavi in exactly the same way as the third figure on this page (a hydrogen electron cloud model) : http://www.sethanil.com/python-for-reseach/5 I have a set of data points which I created using my own model which I would like to use. The data points are stored in a multi-dimensional numpy array like so: XYZV = [[1, 2, 3, 4], [6, 7, 8, 9], ... [4, 5, 6, 7]] The data points are not uniformly spread in XYZ space and not stored in any particular order. I think the example uses a meshgrid to generate the data points - I have looked this up but totally don

Install VTK with anaconda 3.6

一曲冷凌霜 提交于 2019-12-01 23:54:43
I need to install VTK and mayavi on Ubuntu 16. I have Anaconda with Python 3.6. If I run: conda install -c menpo vtk=7.0.0 vtk I get: Fetching package metadata ........... Solving package specifications: . UnsatisfiableError: The following specifications were found to be in conflict: - python 3.6* - vtk 7.0.0* -> python 3.5* -> openssl 1.0.1* - vtk 7.0.0* -> python 3.5* -> xz 5.0.5 Use "conda info <package>" to see the dependencies for each package. Apparently, I need Anaconda with Python3.5, but it's not availabe. Any idea? :) You can also use this: https://anaconda.org/clinicalgraphics/vtk

Does Mayavi “Font Size” text property work?

断了今生、忘了曾经 提交于 2019-12-01 17:06:25
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? I've just downloaded, and installed it, and I seem to be having the same problem. On Windows 8 right now. This is probably a

How to remove Mayavi toolbar in python using code

独自空忆成欢 提交于 2019-12-01 13:12:23
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? You can use Handler to modify UI, the following code works with ETS_TOOLKIT=qt4. Add the DisableToolbarHandler class to the code

How to directly set RGB/RGBA colors in mayavi

断了今生、忘了曾经 提交于 2019-12-01 11:56:53
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? aestrivex 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 import mlab; import numpy as np x,y,z=np.random.random((3,nr_points)) #some data colors=np.random