Python Graphing Utility for GUI with Animations - python

I am trying to create a GUI interface in VB to track... oh, nevermind.
Basically, I want to create a GUI in python to display data, but I am finding that mathplotlib is not suiting my needs. I would like to be able to highlight certain datapoints, have more freedom in the text drawn to the screen, have animations on data movement, and have dropdown menus for data points. From what I have seen, I do not believe that mathplotlib can do these things. What utility can I look into to better suit my needs?

I haven't used it myself but Chaco seems to fit some of your needs. It is more interactive than matplotlib and can be used to make quite interactive applications.
Chaco is a Python plotting application toolkit that facilitates writing plotting applications at all levels of complexity, from simple scripts with hard-coded data to large plotting programs with complex data interrelationships and a multitude of interactive tools. While Chaco generates attractive static plots for publication and presentation, it also works well for interactive data visualization and exploration.
(source: enthought.com)

QGraphicsScene/View from PyQt4 is a fantastic piece of code. Although your description makes me think that some upfront work will be necessary to make things work.
...don 't trust me, I'm biased ;) Get the library here and check the demos.

The equivalent of matplotlib in the PyQt world is PyQwt (matplotlib integrates with PyQt also, but with PyQwt the integration is smoother). Take a look at this comparison between matplotlib and PyQwt:
http://eli.thegreenplace.net/2009/06/05/plotting-in-python-matplotlib-vs-pyqwt/

PyQt + MathGL can do it easily. See this sample.

Related

Simplest way to publish matplotlib-like interactive animation to html?

I'm using matplotlib and python to make an animated scatter plot with points as 'balls' that bounce around, just like this:
https://jakevdp.github.io/downloads/videos/particle_box.mp4
It is interactive at runtime (with sliders to change velocity, attraction, etc), simulating on the go.
I would like to then publish it with the interactivity and all in html.
Problem: I don't know of a way to publish matplotlib interactivity to html directly.
So can I do it in python? Or is there a better way?
Which library (or program, if different from python) would you recommend as the simplest and fastest for this kind of project? I don't need "pretty" customizations and all that, I just need easy calculations and simulations (python) to then plot in a few easy lines of code (matplotlib). I do need to change the dots (balls) colors though.
I have looked at mpld3 that should wrap matplotlib around D3js. But I don't know anything about js and it is not very straightforward, so it would take me a bit to learn.
I have also looked at plotly, but it doesn't seem to have the same customization of the animation I need.
I have looked at Dash with plotly, but it would be a whole new environment to learn, and definitely overkill.
So the questions are: is there a way to output matplotlib interactive animations to html that I haven't found?
If not, what tools would you use to accomplish this project within a fast timeframe and shallow learning curve, based on my beginner/low intermediate python and matplotlib skill level?
Thank you!

Qt: Curve editor or something similar?

I'm using Qt4.8 via PyQt in a Python application. Everything is working fine :-) But I need to present the user with some kind of curve editor, these widgets commonly found in image editing programs for adjusting contrast or color or stuff like this.
So I basically need a widget, which displays a curve with axes and stuff like that and the user should be able to "drop" points onto the curve and adjust the curve.
I thought I could use matplotlib for this, but as far as I see it doesn't provide any "editing" capability...
I wrote a Qt curve editor with OpenGL widget, you can try it.
http://www.shannap.com/qt-curve-editor-en.html
What you probably want is the qwt toolbox. It's like matplotlib for Qt.
http://qwt.sourceforge.net/
It has all kind of neat funcitonality for plots and graphs. Though you won't get the exact thing you need without creating your own subclasses.
You can do curve editor with matplotlib. See for example this YouTube video: http://www.youtube.com/watch?v=nCv_MhaeFo8
And then check the event handling examples: http://matplotlib.sourceforge.net/examples/event_handling/index.html

What's best Python open source library to draw chart?

What's best open source library in Python to draw chart/diagram? 2D is necessary, and 3D is good if provided together. and it has to accept simple input data format like csv.
I googled one called: matplotlib, how is it and any others?
It should be best in terms of the reliability, performance, simple use and easy integration, etc., or a combination of them.
Thanks
From the official python wiki:
Over the years many different plotting modules and packages have been
developed for Python. For most of that time there was no clear
favorite package, but recently matplotlib has become the most widely
used.
matplotlib highlights for me:
easy to learn (based on matlab traditions but also features object-oriented paradigm)
reliable (well-supported, updated, and documented)
robust (check out some of the stuff you can do with it!)
large community of users (well-liked and highly regarded in many circles)
easy to integrate (works natively alongside numpy/scipy)
accepts TeX commands for special formatting
quite the accepted standard for both simple and complicated chart drawing
I personally use it for many purposes including making diagrams for work presentations, graphics for school papers, and even charts and images for formal scientific documentation in mathematics and computer science. Especially the TeX stuff is particularly useful to me.
So I think you had the right idea. Matplotlib came up first in your google search because it's by far the most reputable, and in general the most useful.
In case you want to investigate some others, here's a link to an overview of some available plotting tools on the official python wiki: http://wiki.python.org/moin/NumericAndScientific/Plotting#Plotting_Tools

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)

Best python UI package for simple graph simulations (TSP simulation, etc...)

I've never done any UI programming in python before. What is the best (read most intuitive, easy to use, functional) UI package for python for doing simulations?
I'll be doing a simulation of TSP right now. So I'll have a graph (nodes and edges) where the edges are rapidly changing, along with some selection boxes to choose different styles of the algorithm, choose the number of nodes, etc..
I've already written this code with a command line interface and I'm hoping for something pretty seamless to port in a gui :)
I am not sure what you mean by "simulations" since the type of UI you want to do depends on what you simulate. But if you want to visualize graphs, networkx is pretty cool.
Such a simulation could be easily coded using:
networkx - for the graph data structures and algorithms
matplotlib - which is used by networkx to visualize graphs
Some GUI framework - PyQt, for instance, for the display and interaction with the user
What's cool is that these can be learned and tried separately. networkx is very powerful and can provide anything you need graph-vise. It works well with matplotlib, and you can show the steps of TSP by different colorings of edges/nodes. matplotlib can also be easily integrated with PyQt to put it all into a single interactive program.
Colleagues of mine are working on a similar-sounding setup to you - they use http://matplotlib.sourceforge.net/ and PyQt - PyQt can add a matplotlib object easily as a widget so the two integrate very well. A tutorial for PyQt is available here: http://www.zetcode.com/tutorials/pyqt4/
If you have graphs, you should definitely check out PyGraphviz (the interface is pretty similar to the aforementioned networkx)

Categories