[Matplotlib-users] Un-align animations created with to_jshtml()?
Matthias Geier
matthias.geier at gmail.com
Fri Jul 27 21:22:40 EDT 2018
Dear list.
I love the feature to show animations as HTML with to_jshtml() and I'm
using it in Jupyter notebooks, e.g. here:
https://splines.readthedocs.io/bezier.html
What I don't like, however, is that those animations are always
centered, because the HTML template uses this line:
<div class="animation" align="center">
See also https://github.com/matplotlib/matplotlib/blob/c552bdc116ad518d988461a28a2dd43ca342f2ee/lib/matplotlib/_animation_data.py#L151
I've tried to work against this forced center alignment by including
this snippet in the notebook:
<style>div.animation { width: fit-content; }</style>
But I'm wondering: is there a better way?
There must be a better way!
I would like the animations left-aligned because the normal plots are
also left-aligned.
I'm also wondering: shouldn't the alignment be an optional setting?
Furthermore, the "align" attribute of "div" elements is "obsolete" and
"deprecated" according to
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div
Shouldn't the alignment probably be removed completely?
If I'm using to_html5_video(), the animation isn't centered either, so
this would be actually more consistent.
cheers,
Matthias
More information about the Matplotlib-users
mailing list