Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Doc]: Docstring for artist.Artist.set_agg_filter is incorrect #23050

Copy link
Copy link
Closed
@joezuntz

Description

@joezuntz
Issue body actions

Documentation Link

https://matplotlib.org/3.5.0/api/_as_gen/matplotlib.artist.Artist.set_agg_filter.html#matplotlib.artist.Artist.set_agg_filter

Problem

The docstring for artist.Artist.set_agg_filter states that it accepts "A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array."

This seems to be incorrect - the filter function can actually accept (m, n, 3) or (m, n, 4) arrays, depending on whether an alpha channel is used, and must also return two offsets from the lower-left corner, as described here:

def stop_filter(self, post_processing):

Suggested improvement

The parameter part of the docstring at

def set_agg_filter(self, filter_func):
"""
Set the agg filter.
Parameters
----------
filter_func : callable
A filter function, which takes a (m, n, 3) float array and a dpi
value, and returns a (m, n, 3) array.
.. ACCEPTS: a filter function, which takes a (m, n, 3) float array
and a dpi value, and returns a (m, n, 3) array
"""
self._agg_filter = filter_func
self.stale = True
should be something like:

        filter_func : callable
            A filter function, which takes a (m, n, depth) float array and a dpi
            value, and returns a (m, n, depth) array and two offsets from the bottom 
            left corner of the image
            .. ACCEPTS: a filter function, which takes a (m, n, 3) float array
                and a dpi value, and returns a (m, n, 3) array and two offsets
                from the bottom left corner of the image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.