8000 The RC Param `path.simplify` does nothing. · Issue #8775 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
The RC Param path.simplify does nothing. #8775
Closed
@kbrose

Description

@kbrose

There is no way to trigger the Path Simplification code externally. Setting the path.simplify RC parameter does not actually do anything.

The function definition and docstring for path.iter_segments looks like (I edited out irrelevant portions):

    def iter_segments(self, transform=None, remove_nans=True, clip=None,
                      snap=False, stroke_width=1.0, simplify=None,
                      curves=True, sketch=None):
        """
        Iterates over all of the curve segments in the path.  Each
        iteration returns a 2-tuple (*vertices*, *code*), where
        *vertices* is a sequence of 1 - 3 coordinate pairs, and *code* is
        one of the :class:`Path` codes.

        Additionally, this method can provide a number of standard
        cleanups and conversions to the path.

        Parameters
        ----------
        <<<removed>>>
        simplify : None or bool, optional
            If True, perform simplification, to remove
             vertices that do not affect the appearance of the path.  If
             False, perform no simplification.  If None, use the
             should_simplify member variable.
        <<<removed>>>
        """
        if not len(self):
            return

        cleaned = self.cleaned(transform=transform,
                               remove_nans=remove_nans, clip=clip,
                               snap=snap, stroke_width=stroke_width,
                               simplify=simplify, curves=curves,
                               sketch=sketch)

However, looking at the code for path.cleaned reveals that the None parameters are never overwritten as is claimed by the docstring for iter_segments.

    def cleaned(self, transform=None, remove_nans=False, clip=None,
                quantize=False, simplify=False, curves=False,
                stroke_width=1.0, snap=False, sketch=None):
        """
        Cleans up the path according to the parameters returning a new
        Path instance.

        .. seealso::

            See :meth:`iter_segments` for details of the keyword arguments.

        Returns
        -------
        Path instance with cleaned up vertices and codes.

        """
        vertices, codes = _path.cleanup_path(self, transform,
                                             remove_nans, clip,
                                             snap, stroke_width,
                                             simplify, curves, sketch)

However, I'm not sure that the existing path simplification code is behaving correctly (another Issue incoming, I'll link when it's done), so perhaps this is not a bad thing.

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

      0