Skip to content

Bug docstring for set_matplotlib_formats #44

@Serge3leo

Description

@Serge3leo

For matplotlib_inline.__version__ == '0.1.7' (matplotlib.__version__ == '3.10.5')

from matplotlib_inline.backend_inline import set_matplotlib_formats
help(set_matplotlib_formats)

print:

...
    For example, this enables PNG and JPEG output with a JPEG quality of 90%::

        In [1]: set_matplotlib_formats('png', 'jpeg', quality=90)

But:

import matplotlib.pyplot as plt
from matplotlib_inline.backend_inline import set_matplotlib_formats

set_matplotlib_formats('png', 'jpeg', quality=90)

fig, ax = plt.subplots()
plt.show()

Cause:

...
TypeError: FigureCanvasAgg.print_png() got an unexpected keyword argument 'quality'
...
TypeError: FigureCanvasAgg.print_jpg() got an unexpected keyword argument 'quality'

Workaround, probably use:

set_matplotlib_formats('png', 'jpeg', pil_kwargs=dict(quality=10))

or

%config InlineBackend.print_figure_kwargs = {'pil_kwargs': {'quality' : 90, \
                                                            'optimize': True}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions