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

Method draw_markers

lib/matplotlib/backends/backend_pdf.py:2068–2104  ·  view source on GitHub ↗
(self, gc, marker_path, marker_trans, path, trans,
                     rgbFace=None)

Source from the content-addressed store, hash-verified

2066 output(*self.gc.pop())
2067
2068 def draw_markers(self, gc, marker_path, marker_trans, path, trans,
2069 rgbFace=None):
2070 # docstring inherited
2071
2072 # Same logic as in draw_path_collection
2073 len_marker_path = len(marker_path)
2074 uses = len(path)
2075 if len_marker_path * uses < len_marker_path + uses + 5:
2076 RendererBase.draw_markers(self, gc, marker_path, marker_trans,
2077 path, trans, rgbFace)
2078 return
2079
2080 self.check_gc(gc, rgbFace)
2081 fill = gc.fill(rgbFace)
2082 stroke = gc.stroke()
2083
2084 output = self.file.output
2085 marker = self.file.markerObject(
2086 marker_path, marker_trans, fill, stroke, self.gc._linewidth,
2087 gc.get_joinstyle(), gc.get_capstyle())
2088
2089 output(Op.gsave)
2090 lastx, lasty = 0, 0
2091 for vertices, code in path.iter_segments(
2092 trans,
2093 clip=(0, 0, self.file.width*72, self.file.height*72),
2094 simplify=False):
2095 if len(vertices):
2096 x, y = vertices[-2:]
2097 if not (0 <= x <= self.file.width * 72
2098 and 0 <= y <= self.file.height * 72):
2099 continue
2100 dx, dy = x - lastx, y - lasty
2101 output(1, 0, 0, 1, dx, dy, Op.concat_matrix,
2102 marker, Op.use_xobject)
2103 lastx, lasty = x, y
2104 output(Op.grestore)
2105
2106 def draw_gouraud_triangles(self, gc, points, colors, trans):
2107 assert len(points) == len(colors)

Callers

nothing calls this directly

Calls 7

check_gcMethod · 0.95
strokeMethod · 0.80
markerObjectMethod · 0.80
iter_segmentsMethod · 0.80
fillMethod · 0.45
get_joinstyleMethod · 0.45
get_capstyleMethod · 0.45

Tested by

no test coverage detected