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
rmay31
2
That seems like a convincing argument. Would you open an issue with this in
it?
Ryan
···
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
<div>: The Content Division element - HTML: HyperText Markup Language | MDN
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.
--
Ryan May
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180727/762ee999/attachment.html>
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
<div>: The Content Division element - HTML: HyperText Markup Language | MDN
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?
Issues · matplotlib/matplotlib · GitHub
Thanks Ryan, I've created this issue:
In the meantime, does somebody know a better work-around?
I've realized that my work-around
<style>div.animation { width: fit-content; }</style>
uses an experimental CSS feature which isn't available yet in all browsers.
Any other ideas?
cheers,
Matthias
···
On Sat, Jul 28, 2018 at 4:46 AM, Ryan May wrote:
On Fri, Jul 27, 2018 at 7:23 PM Matthias Geier wrote:
Ryan