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

Function get_path

lib/matplotlib/hatch.py:217–243  ·  view source on GitHub ↗

Given a hatch specifier, *hatchpattern*, generates Path to render the hatch in a unit square. *density* is the number of lines per unit square.

(hatchpattern, density=6)

Source from the content-addressed store, hash-verified

215
216
217def get_path(hatchpattern, density=6):
218 """
219 Given a hatch specifier, *hatchpattern*, generates Path to render
220 the hatch in a unit square. *density* is the number of lines per
221 unit square.
222 """
223 density = int(density)
224
225 patterns = [hatch_type(hatchpattern, density)
226 for hatch_type in _hatch_types]
227 num_vertices = sum([pattern.num_vertices for pattern in patterns])
228
229 if num_vertices == 0:
230 return Path(np.empty((0, 2)))
231
232 vertices = np.empty((num_vertices, 2))
233 codes = np.empty(num_vertices, Path.code_type)
234
235 cursor = 0
236 for pattern in patterns:
237 if pattern.num_vertices != 0:
238 vertices_chunk = vertices[cursor:cursor + pattern.num_vertices]
239 codes_chunk = codes[cursor:cursor + pattern.num_vertices]
240 pattern.set_vertices_and_codes(vertices_chunk, codes_chunk)
241 cursor += pattern.num_vertices
242
243 return Path(vertices, codes)

Callers 1

hatchMethod · 0.90

Calls 2

PathClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…