MCPcopy Index your code
hub / github.com/plotly/plotly.py / SVG_path

Function SVG_path

plotly/matplotlylib/mplexporter/utils.py:92–127  ·  view source on GitHub ↗

Construct the vertices and SVG codes for the path Parameters ---------- path : matplotlib.Path object transform : matplotlib transform (optional) if specified, the path will be transformed before computing the output. Returns ------- vertices : array Th

(path, transform=None, simplify=False)

Source from the content-addressed store, hash-verified

90
91
92def SVG_path(path, transform=None, simplify=False):
93 """Construct the vertices and SVG codes for the path
94
95 Parameters
96 ----------
97 path : matplotlib.Path object
98
99 transform : matplotlib transform (optional)
100 if specified, the path will be transformed before computing the output.
101
102 Returns
103 -------
104 vertices : array
105 The shape (M, 2) array of vertices of the Path. Note that some Path
106 codes require multiple vertices, so the length of these vertices may
107 be longer than the list of path codes.
108 path_codes : list
109 A length N list of single-character path codes, N <= M. Each code is
110 a single character, in ['L','M','S','C','Z']. See the standard SVG
111 path specification for a description of these.
112 """
113 if transform is not None:
114 path = path.transformed(transform)
115
116 vc_tuples = [
117 (vertices if path_code != Path.CLOSEPOLY else [], PATH_DICT[path_code])
118 for (vertices, path_code) in path.iter_segments(simplify=simplify)
119 ]
120
121 if not vc_tuples:
122 # empty path is a special case
123 return np.zeros((0, 2)), []
124 else:
125 vertices, codes = zip(*vc_tuples)
126 vertices = np.array(list(itertools.chain(*vertices))).reshape(-1, 2)
127 return vertices, list(codes)
128
129
130def get_path_style(path, fill=True):

Callers 1

get_marker_styleFunction · 0.85

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected