3 ms·
One aspect of matplotlib that is often overlooked is the animation capabilities. There should be more animations in data-sciency stuff (there's a reason small g
by rjtavares 9y ago
One aspect of matplotlib that is often overlooked is the animation capabilities. There should be more animations in data-sciency stuff (there's a reason small gifs spread so easilly on the internet).
- asfdsfggtfd 9y agoIt can be used for interactive widgets as well.
- chestervonwinch 9y agoExample: [1]. As part of a python library I wrote for querying and manipulating annotations of a medical image dataset, I added, using matplotlib, a very basic DICOM-viewer that interactively flips through slices of chest CT scans and displays annotation info. [1]: https://raw.githubusercontent.com/pylidc/pylidc/master/img/viz-in-scan-example.png https://raw.githubusercontent.com/pylidc/pylidc/master/img/v...
- randlet 9y agoYou may already be aware of it but dicompyler is a nice dicom viewer built in python and it's quite easy to build plugins for it.
- taeric 9y agoI question whether or not animation would really help anything. Rather, I'd wager it would be like most animated PowerPoints.
- wtallis 9y agoIf you're using the animation to add another axis to the plot, that can be extremely useful. But using it to make annotations zip around the screen would be pathetic.
- lottin 9y agoIt's useful in that it allows visualising an extra dimension, most likely time, but I agree it has great potential for misuse. Also it doesn't work on printed material.
- rjtavares 9y agoAn example of something I made with matplotlib: https://streamable.com/dui9k https://streamable.com/dui9k If there's a time dimension, there should be an animation.
- ysr23 9y agoLike that a lot, is that under-pinned chyronhego data by any chance?
- rjtavares 9y agoThanks! That's actually data I collected myself. This animation is part of a blog post I just published [1]. I also have a notebook on github with an example (data & code - [2]) [1] - https://medium.com/football-crunching/the-zone-where-it-happens-31320ed89e1f https://medium.com/football-crunching/the-zone-where-it-happ... [2] - https://github.com/rjtavares/football-crunching/blob/master/notebooks/working%20with%20positional%20data.ipynb https://github.com/rjtavares/football-crunching/blob/master/...
- trextrex 9y agoWe recently released a thin wrapper around matplotlib that makes it easier to do live plots [1] (since matplotlib has a few gotchas). We use it in a fair number of projects internally, since it makes it easier to monitor performance of various models as they are trained, which shortens the code-test loop. [1] https://github.com/IGITUGraz/live-plotter https://github.com/IGITUGraz/live-plotter
- radarsat1 9y agoAre you just referring to ion() and draw(), or do you mean something more specific to animation? I'm really curious, as I use matplotlib in interactive mode frequently, but I find it too slow for showing real-time updates of some on-going compute process. (It literally slows down my computations.. I thought about coming up with some kind of multiprocess answer to this but it would still have slow updates.) Actually I'd be really interested in a simpler library than matplotlib that is specifically designed for live, parallel updates using super fast GPU-driven drawing methods.
- rjtavares 9y agoI'm talking about the animation module: https://matplotlib.org/2.0.0/api/animation_api.html https://matplotlib.org/2.0.0/api/animation_api.html There's also moviepy, which integrates well with matplotlib (they take RGB arrays as inputs to build the video file, but it has an helper function that converts matplotlib figures into numpy RGB arrays - that should be easy to parallelize). Link: http://zulko.github.io/blog/2014/11/29/data-animations-with-python-and-moviepy/ http://zulko.github.io/blog/2014/11/29/data-animations-with-...
- radarsat1 9y agoAh thanks, I haven't used that.
- MereInterest 9y agoMy current issue with the animation module is that there is no way to clear an animation away. You can clear the figure, but the animation will redraw on top of the cleared figure. The only workaround is to delete the FuncAnimation object, but that is difficult to do in a language without deterministic destruction.
- rjtavares 9y agoHave you tried moviepy? It works by converting matplotlib figures into numpy arrays (you can even pre-build a list of arrays and then just iterate over the list). http://zulko.github.io/blog/2014/11/29/data-animations-with-python-and-moviepy/ http://zulko.github.io/blog/2014/11/29/data-animations-with-...