Skip to content

[Bug]: set_edgecolor(None) cannot recover the default style after changing the edge color of wedges with hatches #31225

@williamlus

Description

@williamlus

Bug summary

This bug occurs when I create a pie chart with hatches, then specify the edge color to red, and reset it to None to recover the default style. However, the actual result displays red hatches.

Code for reproduction

import matplotlib.pyplot as plt

labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]

fig, ax = plt.subplots()
wedges, texts = ax.pie(sizes, labels=labels, hatch=['**O', 'oO', 'O.O', '.||.'])
for wedge in wedges: wedge.set_edgecolor(None)
plt.savefig('plot1.png')
for wedge in wedges: wedge.set_edgecolor('r')
for wedge in wedges: wedge.set_edgecolor(None)
plt.savefig('plot2.png')

Actual outcome

plot1.png

Image

plot2.png

Image

Expected outcome

plot1.png

Image

plot2.png

Image

Additional information

No response

Operating system

No response

Matplotlib Version

3.10.8

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions