简体   繁体   中英

Interactive plotting in Python?

Matlab and Mathematica both have features that allow the user to manipulate the contents of a plot using, say, a slider. For example, if you have a set of 3D data, it is easy to make a small program that lets you view 2D slices of a set of 3D data where the user can slide a slider to move through which slice is displayed. Is there anything in python that allows for this sort of capability without tons of effort? For example, is it possible to do such a thing in matplotlib, or something similar? I

Thanks.

My first thought would be Mayavi , which is great for data visualization, especially in 3D. It relies on VTK . It is included in the Enthought flavoured version of Python, together with Chaco for 2D plotting. To get an idea, look at Travis Vaught's nice screencast in Multidimensional Data Visualization in Python - Mixing Chaco and Mayavi .

It also possible to embed basic interactive functionalities (like slider) to Matplotlib, see matplotlib.widgets and the widget examples.

Finally, you can use rpy (or better, rpy2 ) and benefit from the R interface.

Have you looked at Vtk? http://www.vtk.org/ One of their demos does exactly what you're asking.

In principle, you can do it by help of MathGL . This is cross-platform GPL library for plotting.

For each mouse clicks you can find the x,y,z position in plot or clicked object and adjust (replot) some other information correspondingly. However you should handle mouse clicks by yourself (for example, using PyQt).

Another option is to use python within the SAGE computation interface/environment, which has the @interact command (see here for specific help on this command)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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