Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

wrong hatch color in legend #8463

Copy link
Copy link
Closed
Closed
Copy link
@bastibl

Description

@bastibl
Issue body actions

Follow-up of #8076.

Bug report

Bug summary

  • the hatch color in the legend doesn't match the color in the figure

Code for reproduction

  • A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as patches

verts = [
    (0., 0.), # left, bottom
    (0., 1.), # left, top
    (1., 1.), # right, top
    (1., 0.), # right, bottom
    (0., 0.), # ignored
    ]

codes = [Path.MOVETO,
         Path.LINETO,
         Path.LINETO,
         Path.LINETO,
         Path.CLOSEPOLY,
         ]

path = Path(verts, codes)

fig = plt.figure()
ax = fig.add_subplot(111)
patch = patches.PathPatch(path, color='green', fill=False, hatch='xx', lw=2, label='foo')
ax.add_patch(patch)
ax.set_xlim(-.5,1.5)
ax.set_ylim(-.5,1.5)
ax.legend(handlelength=10, handleheight=10)
plt.show()

Actual outcome

  • The legend uses a black hatch color

Expected outcome

  • The hatch color in the legend matches the hatch color in the figure.

Matplotlib version
Current v2.0.x branch (matplotlib-2.0.0+160.ge9ab1cf)

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
    Python 2.7, Ubuntu 16.04
  • How did you install Matplotlib and Python (pip, anaconda, from source ...)
    pip install git+https://github.com/matplotlib/matplotlib.git@v2.0.x#matplotlib

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.