Skip to content

path.sketch doesn't apply to PolyCollection #19693

Closed

Description

@story645

Bug report

Bug summary
PolyCollection lines aren't affected by changes to the path.sketch rcparam, even though patches
are-the docs say that polycollection defaults to patch RC params
image

Code for reproduction

import numpy as np

import matplotlib.collections as mcollections
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from matplotlib import rcParams


rcParams['path.sketch'] = (.5, 25, 20)

fig, (ax1, ax2) = plt.subplots(ncols=2)
f1 = mpatches.Rectangle((.25,.25), .5, .5, facecolor='white', edgecolor='C0', linewidth=2)
ax1.add_patch(f1)

verts = np.array([[[1,-1], [1,1], [2.4, 1.5], [2.4, -.5]],
                 [[-.4,1.5],[-.4,-.5],[1,-1],[1,1]],
                 [[-.4, 1.5], [1, 2],[2.4, 1.5], [1,1]]])
verts2 = verts*.25 + [.3]
p = mcollections.PolyCollection(np.vstack([verts, verts2]), facecolor='white', edgecolor='C0', linewidth=2)
ax2.add_collection(p)

Matplotlib version

  • Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.3.4
  • Matplotlib backend (print(matplotlib.get_backend())): jupyter inline

Activity

  1. oscargus commented on Feb 27, 2022

    @oscargus
    Member

    It seems to be an issue with the rendering as p.get_sketch_params() returns the correct value.

  2. oscargus commented on Apr 7, 2023

    @oscargus
    Member

    It also seems to be an issue with the agg-backend. Saving as PDF or SVG gives the correct result.

  3. added this to the v3.10.0 milestone on Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions