From 690f7d35cab678e387dc41993a58b338cf34120e Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 16 Apr 2026 14:55:10 -0400 Subject: [PATCH] Make Animation._repr_html_ more useful by default While `Animation` does define `_repr_html_`, it does nothing by default since `animation.html` is 'none'. The 'html5' option is the best, but it requires FFmpeg to be installed. So introduce a new 'auto' option that picks either one depending on what's available, and make it the default. --- lib/matplotlib/animation.py | 24 +++++++++++++++++------- lib/matplotlib/mpl-data/matplotlibrc | 9 +++++---- lib/matplotlib/rcsetup.py | 14 ++++++++------ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index f20928d0abc2..c5d768a888e3 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1274,7 +1274,7 @@ def _end_redraw(self, event): self._resize_id = self._fig.canvas.mpl_connect('resize_event', self._on_resize) - def to_html5_video(self, embed_limit=None): + def to_html5_video(self, embed_limit=None, _writer_cls=None): """ Convert the animation to an HTML5 ``