MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / __init__

Method __init__

lib/matplotlib/collections.py:2215–2258  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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())

Callers

nothing calls this directly

Calls 6

set_pathsMethod · 0.95
get_edgecolorMethod · 0.45
get_linewidthMethod · 0.45
get_linestyleMethod · 0.45
get_antialiasedMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected