[Bug]: Wedge tight bounding box incorrect · Issue #21931 · matplotlib/matplotlib · GitHub
Skip to content

[Bug]: Wedge tight bounding box incorrect #21931

Description

@dstansby

Bug summary

The tight bounding box of a Wedge patch appears to be incorrect. I suspect this is HiDPI issue - multiplying x0/y0/width/height by 2 seems to result in the correct bounding box for me.

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle, Wedge

fig, ax = plt.subplots()
wedge = Wedge(0.5, 0.4, 10, 30)
ax.add_patch(wedge)

# Plot bounding box
renderer = fig.canvas.get_renderer()
bbox = wedge.get_tightbbox(renderer)
rect = Rectangle((bbox.x0, bbox.y0), width=bbox.width, height=bbox.height,
                 linewidth=72./fig.dpi, edgecolor="red", facecolor="none",
                 transform=None)
fig.add_artist(rect)
plt.show()

Actual outcome

Screenshot 2021-12-11 at 17 41 18

Expected outcome

Red bounding box bounds the blue wedge.

Additional information

No response

Operating system

macOS

Matplotlib Version

3.6.0.dev1023+gb0f7b8aaf8

Matplotlib Backend

Qt5Agg

Python version

3.9.7

Jupyter version

No response

Installation

git checkout

Activity

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions