X Tutup
Skip to content

savefig SVG and PDF output for scatter plots is excessively complex, crashses Inkscape #5967

@michaelerule

Description

@michaelerule

Hi! This bug is an issue with interoperability with Inkscape. It can be solved either by improving the performance of Inkscape for certain pathological cases, or by fixing Matplotlib such that it generates non-pathological outputs. To reproduce this issue, generate a scatter plot with a few thousand points, save it as a pdf using savefig(), and then attempt to edit it in Inkscape. The application should hang for up to minutes between mouse clicks while attempting to redraw the point cloud. I suspect the issue is caused by Matplotlib generating output with a very high depth of nested groups, as well as possibly applying excessive clipping when it is not necessary. So far, I can't even use a python script to strip out the redundant tags as the level of nesting is so high that it causes a stack overflow.

edit: On further inspection, it looks like Matplotlib is not only generating deeply nested groups, but that it's storing almost the entire scatter plot in essentially a linked-list of groups, with each point defined in terms of a transform relative to the previous point. This really should not be happening.

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

      X Tutup