📜 ⬆️ ⬇️

We draw a color cube in Mayavi

Greetings, habravchane!

Today I want to tell you about what Mayavi is and what they wash it down with .

Mayavi is a cross-platform application for visualizing scientific data (and not only). It is distributed under the BSD license, which allows its use in commercial applications.
image
')
What can?


You can work with it in three ways:
1) Work directly in the Mayavi interface.
2) Upload / upload ready data to Mayavi.
3) Write a Python script in which you can set all the desired features for Mayavi.


After launching the stand-alone version, we get this nice window:
image

The screen is divided into 4 parts:


Let me explain why you need a terminal:

Create some object and select it in the list of objects. Select and, without releasing the left mouse button, drag it to the terminal window. We get something like
<enthought.mayavi.modules.surface.Surface object at 0x0DADE5D0>
Now we will write:
explore(_)
and then a window will appear with all the parameters of the object. This is a very useful thing that can help in learning and creating your own scripts. I recognized some properties of objects in this way, without finding them in the documentation. In this window, the Drag'N'Drop rule works in the same way.

image

There are quite a lot of examples in the Mayavi documentation, which generally explain what to do and how.

I will try to describe the rake that I stepped on. For the most part, they will be concerned with embedding the Mayavi frame in the PyQt widget (or PySide, which I have already written about .



Start and get this window:
image

Press the button and get a colored cube:
image

If you want to see something more scientific, you can take a look at it:
image

Well, you can also create something futuristic (inside one parallelepiped with the included inner edges):
image

On it I complete the topic. If you want to see something else, then I am waiting for comments.

PS A little later I will write a topic about Chaco. I hope you are just as interesting to read about him?

Source: https://habr.com/ru/post/115170/


All Articles