Parameters ---------- patches : list of `.Patch` A sequence of Patch objects. This list may include a heterogeneous assortment of different patch types. match_original : bool, default: False If True, use the colors and linewidths
(self, patches, *, match_original=False, **kwargs)
| 2213 | """ |
| 2214 | |
| 2215 | def __init__(self, patches, *, match_original=False, **kwargs): |
| 2216 | """ |
| 2217 | Parameters |
| 2218 | ---------- |
| 2219 | patches : list of `.Patch` |
| 2220 | A sequence of Patch objects. This list may include |
| 2221 | a heterogeneous assortment of different patch types. |
| 2222 | |
| 2223 | match_original : bool, default: False |
| 2224 | If True, use the colors and linewidths of the original |
| 2225 | patches. If False, new colors may be assigned by |
| 2226 | providing the standard collection arguments, facecolor, |
| 2227 | edgecolor, linewidths, norm or cmap. |
| 2228 | |
| 2229 | **kwargs |
| 2230 | All other parameters are forwarded to `.Collection`. |
| 2231 | |
| 2232 | If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds* |
| 2233 | are None, they default to their `.rcParams` patch setting, in |
| 2234 | sequence form. |
| 2235 | |
| 2236 | Notes |
| 2237 | ----- |
| 2238 | The use of `~matplotlib.cm.ScalarMappable` functionality is optional. |
| 2239 | If the `~matplotlib.cm.ScalarMappable` matrix ``_A`` has been set (via |
| 2240 | a call to `~.ScalarMappable.set_array`), at draw time a call to scalar |
| 2241 | mappable will be made to set the face colors. |
| 2242 | """ |
| 2243 | |
| 2244 | if match_original: |
| 2245 | def determine_facecolor(patch): |
| 2246 | if patch.get_fill(): |
| 2247 | return patch.get_facecolor() |
| 2248 | return [0, 0, 0, 0] |
| 2249 | |
| 2250 | kwargs['facecolors'] = [determine_facecolor(p) for p in patches] |
| 2251 | kwargs['edgecolors'] = [p.get_edgecolor() for p in patches] |
| 2252 | kwargs['linewidths'] = [p.get_linewidth() for p in patches] |
| 2253 | kwargs['linestyles'] = [p.get_linestyle() for p in patches] |
| 2254 | kwargs['antialiaseds'] = [p.get_antialiased() for p in patches] |
| 2255 | |
| 2256 | super().__init__(**kwargs) |
| 2257 | |
| 2258 | self.set_paths(patches) |
| 2259 | |
| 2260 | def set_paths(self, patches): |
| 2261 | paths = [p.get_transform().transform_path(p.get_path()) |
nothing calls this directly
no test coverage detected