Skip to content

rcParams restrictions on frame_formats are out of sync with supported values (HTMLWriter) #17908

Closed
@bmcfee

Description

@bmcfee

Bug report

jshtml animation uses HTMLWriter to render animation frames. Digging into the code for this, we see that HTMLWriter lists supported_formats:

supported_formats = ['png', 'jpeg', 'tiff', 'svg']

However, there is no way to make use of this. The to_jshtml method of animation does not provide an interface to specify the frame format, so it must be pulled from rcParams. rcParams, in turn, does not allow svg as an option.

Code for reproduction

import matplotlib
matplotlib.rcParams['animation.frame_format'] = 'svg'

Actual outcome

# ... traceback cruft

ValueError: Key animation.frame_format: Unrecognized animation.frame_format string 'svg': valid strings are ['png', 'jpeg', 'tiff', 'raw', 'rgba']

Expected outcome

rcParams should allow setting frame formats that are supported by any animation writer, not just the ones supported by all.

Aside: rcParams allows raw but HTMLWriter doesn't. So there's already precedent.

Matplotlib version

  • Operating system: linux
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg (but irrelevant to this issue)
  • Python version: 3.7.6
  • Jupyter version (if applicable): n/a
  • Other libraries: n/a

conda (main anaconda)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions