See also diagrams.
Just imagine that we could have a language that combined high-performance numerical operations, interactive debugging, effortless integration of realtime and non-realtime interaction, easy parallelism, a large and active user community, ran on windows, linux, OS X and smartphones, had well-documented, performant graphics and smooth GUI integration.
Now, welcome to the real world, where every project is either
- a reasonably functional hodgepodge of the least-worst options that don’t suck in a particular domain, or
- grossly deficient in some way.
So, now I’m going to try to get some realtime data visualisation going in python via the hodgepodge method. Visualisation is not especially a strong point of the language; the strong point is hodgepodge, decoupage, bricolage, and, uh, potpourri. I think we can cobble something together, or better, use someone else’s cobbling.
the classic option is matplotlib although it can’t yet do all your modern hipster graphs and is awful at animations and interactions, and it fugly per default. However, there are libraries which use matplotlib as a backend that are fare more beautiful:
Holoviews has been crafted by some neurologists to serve science. Fresh, enthusiastic, practical and a leeetle bit ugly.
VisPy is OpenGL-backed data visualisation, focussing on science (ooh!). It also offers a matplotlib compatibility layer. Here are some howtos:
Mayavi is an opinionated open-source commercially-backed interactive 3D visualiser. Its aesthetic I find grating. The source code repository is worryingly hard to find. For future reference, it’s here.
on a similar tip, although looking more basic and more bitrotten, is vtk - if I understand correctly, VTK is the engine used by Mayavi?
Disney (!) has a game library Panda3d, that seems to do all the fun things
even more bareback, more-or-less-directly calling into openGL, but seriously, I’m a statistician, not a coder. I could also hand-pulp hemp to make my own graph paper to draw my visualisations, drawn in home-made iron gall ink, but I would find it equally hard to argue that it was an efficient prioritisation.
I haven’t used PREdator (although I understand it’s been around longer than I. Heh.) Wiedemann, C., Bellstedt, P., & Görlach, M. (2014). PREdator: a python based GUI for data analysis, evaluation and fitting. Source Code for Biology and Medicine, 9(1), 21. DOI. Online.
jupyter notebooks have a rich enough API to integrate various more exotic graphics options; In fact, since you are now using the web browser, you can go straight into browser datavis, which is powerful and super hip.
Here are some promising hacks
- superset is Airbnb’s python+browser interactive data exploration tool.
- There is a full(ish) d3.js backend for matplotlib called mpld3
- same tool (web browser), different approach: bokeh does “big-data” and streaming-based browser graphing for python. And its website probably looks the nicest out of everything I’ve mentioned, which counts for a lot. However, its print-output is bad; this is a web-oriented tool
- INRIA’s Tulip has fans
- Visualizing a NetworkX graph in the IPython notebook with d3.js
And we can roll our own JS integration: DIY python web gui by David Baird:
In this howto, I explain the following concepts:
- How to launch a GUI toolkit in a separate thread, and how to communicate with this thread.
- How to embed a web browser inside the GUI, and how to communicate with this embedded web browser without using sockets. By not using sockets, we don’t have to worry about socket security, and we don’t have to worry about allocating a socket. […] In other words, we will have AJAX-like […] functionality to communicate with Python but without actually having to use AJAX.
- log y-axis plots, esp histograms