🌐 AI搜索 & 代理 主页
Skip to content

Patch edgecolor of a legend item does not follow look of figure #7375

@jorisvandenbossche

Description

@jorisvandenbossche

It's not about the edgecolor of the legend box, but of the legend items (if they are a patch). In the following example, the clear border around the patches in the legend is a bit surprising to me, and contrasts the look of the figure itself.

Example code:

fig, ax = plt.subplots()
ax.hist(np.random.randn(1000), alpha=0.5, label='group 1')
ax.hist(np.random.randn(1000) + 2, alpha=0.5, label='group 2')
ax.legend()

index

As a notebook: http://nbviewer.jupyter.org/gist/jorisvandenbossche/68b2831ea2b87c76d944e93edc134d59

This issue now surfaces because the default changed to no border for patches, and as such for the histogram in this example (before 2.0, this would not be an issue with the default look). And it becomes more apparent due to the use of a lower alpha in this specific example.

Not sure if this is still the case with master, but I tested with matplotlib 2.0.0b4, on Python 3.5 / Ubuntu (installed from conda-forge)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions