[Matplotlib-users] Un-align animations created with to_jshtml()?

Ryan May rmay31 at gmail.com
Fri Jul 27 22:46:06 EDT 2018


On Fri, Jul 27, 2018 at 7:23 PM Matthias Geier <matthias.geier at gmail.com>
wrote:

> 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.
>

That seems like a convincing argument. Would you open an issue with this in
it?

https://github.com/matplotlib/matplotlib/issues

Ryan

-- 
Ryan May
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180727/762ee999/attachment.html>


More information about the Matplotlib-users mailing list