@@ -1822,10 +1822,13 @@ def __init__(self, patches, *, match_original=False, **kwargs):
1822
1822
a heterogeneous assortment of different patch types.
1823
1823
1824
1824
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
1827
1828
providing the standard collection arguments, facecolor,
1828
1829
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.
1829
1832
1830
1833
**kwargs
1831
1834
All other parameters are forwarded to `.Collection`.
@@ -1843,17 +1846,19 @@ def __init__(self, patches, *, match_original=False, **kwargs):
1843
1846
"""
1844
1847
1845
1848
if match_original :
1846
- def determine_facecolor (patch ):
1847
- if patch .get_fill ():
1848
- return patch .get_facecolor ()
1849
- return [0 , 0 , 0 , 0 ]
1850
-
1851
- kwargs ['facecolors' ] = [determine_facecolor (p ) for p in patches ]
1852
- kwargs ['edgecolors' ] = [p .get_edgecolor () for p in patches ]
1849
+ kwargs ['facecolors' ] = [p .get_facecolor () for p in patches ]
1853
1850
kwargs ['linewidths' ] = [p .get_linewidth () for p in patches ]
1854
1851
kwargs ['linestyles' ] = [p .get_linestyle () for p in patches ]
1855
1852
kwargs ['antialiaseds' ] = [p .get_antialiased () for p in patches ]
1856
1853
1854
+ # Edgecolors are handled separately because are defaulted to None
1855
+ # and the Hatch colors depend on them.
1856
+ if any (p ._original_edgecolor is not None for p in patches ):
1857
+ kwargs ["edgecolors" ] = [p .get_edgecolor () for p in patches ]
1858
+
1859
+ # Using the hatch of only the first patch
1860
+ kwargs ['hatch' ] = patches [0 ].get_hatch ()
1861
+
1857
1862
super ().__init__ (** kwargs )
1858
1863
1859
1864
self .set_paths (patches )
0 commit comments