Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Surprising behavior of hatches in fill_between #11418

Open
Labels
Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesDocumentationbackend: pdfkeepItems to be ignored by the “Stale” Github Actiontopic: hatch
@mwaskom

Description

@mwaskom

Bug report

Hatches are invisible in the output ofax.fill_between whencolor is specified. They are present whencolor is absent or whenfacecolor is used.

I found#9894 which might be related, but seems to be a much narrower

Code for reproduction

importmatplotlib.pyplotaspltf,ax=plt.subplots()ax.fill_between([0,1], [0,1],hatch="//")f.savefig("test1.png")f,ax=plt.subplots()ax.fill_between([0,1], [0,1],hatch="//",color="g")f.savefig("test2.png")f,ax=plt.subplots()ax.fill_between([0,1], [0,1],hatch="//",facecolor="g")f.savefig("test3.png")

Actual outcome

test1.png:
test1

test2.png:
test2

test3.png:
test3

Expected outcome

I expectedtest2.png to have black hatch marks. I think what's happening is that thecolor= kwarg is being picked up globally by the artist and so the hatches intest2.png are there, they just have the same green color as the background. Unfortunately I don't think any hatch metadata other than the string code gets added to the artist, so I can't check.

Havingcolor= globally change both the face and edge color of the artist makes a certain amount of sense, and I think the hatches are mostly inheriting their attributes from the kwargs that set the edge aesthetics. So I think I understand what's happening, but it took me a long time to figure out why the hatch argument had, apparently, no effect. I'll also note that thehatch demo is using thecolor= kwarg, but withax.bar.

Matplotlib version

  • Operating system: MacOS
  • Matplotlib version: 2.2.2
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 3.6
  • Jupyter version (if applicable): NA
  • Other libraries: NA

This is a fresh install from conda to test, but I also saw it on matplotlib 2.2.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesDocumentationbackend: pdfkeepItems to be ignored by the “Stale” Github Actiontopic: hatch

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp