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

Commit70a3f9b

Browse files
committed
Fixed hatching in PatchCollection class
1 parentebbef87 commit70a3f9b

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

‎lib/matplotlib/collections.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,10 +1822,13 @@ def __init__(self, patches, *, match_original=False, **kwargs):
18221822
a heterogeneous assortment of different patch types.
18231823
18241824
match_original : bool, default: False
1825-
If True, use the colors and linewidths of the original
1826-
patches. If False, new colors may be assigned by
1825+
If True, use the colors, linewidths, linestyles
1826+
and the hatch of the original patches.
1827+
If False, new colors may be assigned by
18271828
providing the standard collection arguments, facecolor,
18281829
edgecolor, linewidths, norm or cmap.
1830+
Also, all hatches will be set to the first patch's hatch,
1831+
regardless of the hatch set in the original patches.
18291832
18301833
**kwargs
18311834
All other parameters are forwarded to `.Collection`.
@@ -1843,17 +1846,19 @@ def __init__(self, patches, *, match_original=False, **kwargs):
18431846
"""
18441847

18451848
ifmatch_original:
1846-
defdetermine_facecolor(patch):
1847-
ifpatch.get_fill():
1848-
returnpatch.get_facecolor()
1849-
return [0,0,0,0]
1850-
1851-
kwargs['facecolors']= [determine_facecolor(p)forpinpatches]
1852-
kwargs['edgecolors']= [p.get_edgecolor()forpinpatches]
1849+
kwargs['facecolors']= [p.get_facecolor()forpinpatches]
18531850
kwargs['linewidths']= [p.get_linewidth()forpinpatches]
18541851
kwargs['linestyles']= [p.get_linestyle()forpinpatches]
18551852
kwargs['antialiaseds']= [p.get_antialiased()forpinpatches]
18561853

1854+
# Edgecolors are handled separately because are defaulted to None
1855+
# and the Hatch colors depend on them.
1856+
ifany(p._original_edgecolorisnotNoneforpinpatches):
1857+
kwargs["edgecolors"]= [p.get_edgecolor()forpinpatches]
1858+
1859+
# Using the hatch of only the first patch
1860+
kwargs['hatch']=patches[0].get_hatch()
1861+
18571862
super().__init__(**kwargs)
18581863

18591864
self.set_paths(patches)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp