Skip to content

[Bug]: .eps greyscale hatching of patches when lw=0 #22792

Closed
@topper91

Description

@topper91

Bug summary

Export to .eps-format of patches that are filled with a colored hatch pattern appear in greyscale color when linewidth of the patch is set to zero.

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse

ax = plt.gca()
ax.add_patch(Ellipse((0, 0), 1, 1, hatch='/', facecolor='none', edgecolor='r', linewidth=0))

plt.savefig(r"E:\mwe.png")
plt.savefig(r"E:\mwe.eps")

plt.show()

Actual outcome

.eps-file converted to .png-format using GIMP 2.10.30

mwe_converted_from_eps

Expected outcome

.png-file exported by matplotlib

mwe

.eps-file exported by matplotlib with linewidth > 0 converted to .png-format using GIMP 2.10.30

mwe_2_converted_from_eps

Additional information

It happens when linewidth is set to zero.

I don't know if it worked in earlier versions.

I had a look on the eps-commands in the file. (I don't know anything about eps-format.) It is most likely due to certain eps-commands being removed when linewidth is set to zero, including a command for the line color.

Operating system

Windows 10

Matplotlib Version

3.5.1

Matplotlib Backend

TkAgg

Python version

3.9.10

Jupyter version

n/a

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions