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

Class Patch

lib/matplotlib/patches.py:35–763  ·  view source on GitHub ↗

A patch is a 2D artist with a face color and an edge color. If any of *edgecolor*, *facecolor*, *linewidth*, or *antialiased* are *None*, they default to their rc params setting.

Source from the content-addressed store, hash-verified

33 "linewidth": ["lw"],
34})
35class Patch(artist.Artist):
36 """
37 A patch is a 2D artist with a face color and an edge color.
38
39 If any of *edgecolor*, *facecolor*, *linewidth*, or *antialiased*
40 are *None*, they default to their rc params setting.
41 """
42 zorder = 1
43
44 # Whether to draw an edge by default. Set on a
45 # subclass-by-subclass basis.
46 _edge_default = False
47
48 def __init__(self, *,
49 edgecolor=None,
50 facecolor=None,
51 color=None,
52 linewidth=None,
53 linestyle=None,
54 antialiased=None,
55 hatch=None,
56 fill=True,
57 capstyle=None,
58 joinstyle=None,
59 hatchcolor=None,
60 edgegapcolor=None,
61 **kwargs):
62 """
63 The following kwarg properties are supported
64
65 %(Patch:kwdoc)s
66 """
67 super().__init__()
68
69 if linestyle is None:
70 linestyle = "solid"
71 if capstyle is None:
72 capstyle = CapStyle.butt
73 if joinstyle is None:
74 joinstyle = JoinStyle.miter
75
76 self._hatch_linewidth = mpl.rcParams['hatch.linewidth']
77 self._fill = bool(fill) # needed for set_facecolor call
78 if color is not None:
79 if edgecolor is not None or facecolor is not None:
80 _api.warn_external(
81 "Setting the 'color' property will override "
82 "the edgecolor or facecolor properties.")
83 self.set_color(color)
84 else:
85 self.set_edgecolor(edgecolor)
86 self.set_hatchcolor(hatchcolor)
87 self.set_facecolor(facecolor)
88
89 self._linewidth = 0
90 self._unscaled_dash_pattern = (0, None) # offset, dash
91 self._dash_pattern = (0, None) # offset, dash (scaled by linewidth)
92 self._gapcolor = None

Callers 6

test_default_antialiasedFunction · 0.90
test_default_linestyleFunction · 0.90
test_default_capstyleFunction · 0.90
test_default_joinstyleFunction · 0.90
custom_legends.pyFile · 0.90

Calls

no outgoing calls

Tested by 5

test_default_antialiasedFunction · 0.72
test_default_linestyleFunction · 0.72
test_default_capstyleFunction · 0.72
test_default_joinstyleFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…