Thanks to visit codestin.com
Credit goes to github.com

Skip to content

alpha is not set correctly when using eps format #1740

Closed
@ppurka

Description

@ppurka

Consider the following piece of code:

from matplotlib.figure import Figure
figure=Figure()
subplot = figure.add_subplot(111)
import matplotlib.patches as patches
p = patches.Polygon([(0,0), (1,2), (0,1), (-1,2)], fill=True, alpha=0.1)
patches.Patch.get_facecolor(p)
Out[6]: (0.0, 0.0, 1.0, 0.1)

subplot.add_patch(p)
from matplotlib.backends.backend_agg import FigureCanvasAgg
figure.set_canvas(FigureCanvasAgg(figure))
figure.savefig('a.eps')
figure.savefig('a.pdf')

The image a.eps gets a solid fill that would be obtained if we gave alpha=1 (but alpha=0.0 gives an empty fill, as it should). And the image a.pdf gets the correct alpha 0.1 fill.

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