Python matplotlib.bezier.get_cos_sin() Examples
The following are 9
code examples of matplotlib.bezier.get_cos_sin().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.bezier
, or try the search function
.
Example #1
Source File: axisline_style.py From Computable with MIT License | 6 votes |
def _extend_path(self, path, mutation_size=10): """ Extend the path to make a room for drawing arrow. """ from matplotlib.bezier import get_cos_sin x0, y0 = path.vertices[-2] x1, y1 = path.vertices[-1] cost, sint = get_cos_sin(x0, y0, x1, y1) d = mutation_size * 1. x2, y2 = x1 + cost*d, y1+sint*d if path.codes is None: _path = Path(np.concatenate([path.vertices, [[x2, y2]]])) else: _path = Path(np.concatenate([path.vertices, [[x2, y2]]]), np.concatenate([path.codes, [Path.LINETO]])) return _path
Example #2
Source File: axisline_style.py From matplotlib-4-abaqus with MIT License | 6 votes |
def _extend_path(self, path, mutation_size=10): """ Extend the path to make a room for drawing arrow. """ from matplotlib.bezier import get_cos_sin x0, y0 = path.vertices[-2] x1, y1 = path.vertices[-1] cost, sint = get_cos_sin(x0, y0, x1, y1) d = mutation_size * 1. x2, y2 = x1 + cost*d, y1+sint*d if path.codes is None: _path = Path(np.concatenate([path.vertices, [[x2, y2]]])) else: _path = Path(np.concatenate([path.vertices, [[x2, y2]]]), np.concatenate([path.codes, [Path.LINETO]])) return _path
Example #3
Source File: axisline_style.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def _extend_path(self, path, mutation_size=10): """ Extend the path to make a room for drawing arrow. """ from matplotlib.bezier import get_cos_sin x0, y0 = path.vertices[-2] x1, y1 = path.vertices[-1] cost, sint = get_cos_sin(x0, y0, x1, y1) d = mutation_size * 1. x2, y2 = x1 + cost*d, y1+sint*d if path.codes is None: _path = Path(np.concatenate([path.vertices, [[x2, y2]]])) else: _path = Path(np.concatenate([path.vertices, [[x2, y2]]]), np.concatenate([path.codes, [Path.LINETO]])) return _path
Example #4
Source File: axisline_style.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _extend_path(self, path, mutation_size=10): """ Extend the path to make a room for drawing arrow. """ from matplotlib.bezier import get_cos_sin x0, y0 = path.vertices[-2] x1, y1 = path.vertices[-1] cost, sint = get_cos_sin(x0, y0, x1, y1) d = mutation_size * 1. x2, y2 = x1 + cost*d, y1+sint*d if path.codes is None: _path = Path(np.concatenate([path.vertices, [[x2, y2]]])) else: _path = Path(np.concatenate([path.vertices, [[x2, y2]]]), np.concatenate([path.codes, [Path.LINETO]])) return _path
Example #5
Source File: axisline_style.py From CogAlg with MIT License | 6 votes |
def _extend_path(self, path, mutation_size=10): """ Extend the path to make a room for drawing arrow. """ from matplotlib.bezier import get_cos_sin x0, y0 = path.vertices[-2] x1, y1 = path.vertices[-1] cost, sint = get_cos_sin(x0, y0, x1, y1) d = mutation_size * 1. x2, y2 = x1 + cost*d, y1+sint*d if path.codes is None: _path = Path(np.concatenate([path.vertices, [[x2, y2]]])) else: _path = Path(np.concatenate([path.vertices, [[x2, y2]]]), np.concatenate([path.codes, [Path.LINETO]])) return _path
Example #6
Source File: patches.py From Computable with MIT License | 4 votes |
def transmute(self, path, mutation_size, linewidth): if self.scaleA is None: scaleA = mutation_size else: scaleA = self.scaleA if self.scaleB is None: scaleB = mutation_size else: scaleB = self.scaleB vertices_list, codes_list = [], [] if self.bracketA: x0, y0 = path.vertices[0] x1, y1 = path.vertices[1] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t, self.widthA * scaleA, self.lengthA * scaleA) vertices_list.append(verticesA) codes_list.append(codesA) vertices_list.append(path.vertices) codes_list.append(path.codes) if self.bracketB: x0, y0 = path.vertices[-1] x1, y1 = path.vertices[-2] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesB, codesB = self._get_bracket(x0, y0, cos_t, sin_t, self.widthB * scaleB, self.lengthB * scaleB) vertices_list.append(verticesB) codes_list.append(codesB) vertices = np.concatenate(vertices_list) codes = np.concatenate(codes_list) p = Path(vertices, codes) return p, False
Example #7
Source File: patches.py From matplotlib-4-abaqus with MIT License | 4 votes |
def transmute(self, path, mutation_size, linewidth): if self.scaleA is None: scaleA = mutation_size else: scaleA = self.scaleA if self.scaleB is None: scaleB = mutation_size else: scaleB = self.scaleB vertices_list, codes_list = [], [] if self.bracketA: x0, y0 = path.vertices[0] x1, y1 = path.vertices[1] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t, self.widthA * scaleA, self.lengthA * scaleA) vertices_list.append(verticesA) codes_list.append(codesA) vertices_list.append(path.vertices) codes_list.append(path.codes) if self.bracketB: x0, y0 = path.vertices[-1] x1, y1 = path.vertices[-2] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesB, codesB = self._get_bracket(x0, y0, cos_t, sin_t, self.widthB * scaleB, self.lengthB * scaleB) vertices_list.append(verticesB) codes_list.append(codesB) vertices = np.concatenate(vertices_list) codes = np.concatenate(codes_list) p = Path(vertices, codes) return p, False
Example #8
Source File: patches.py From neural-network-animation with MIT License | 4 votes |
def transmute(self, path, mutation_size, linewidth): if self.scaleA is None: scaleA = mutation_size else: scaleA = self.scaleA if self.scaleB is None: scaleB = mutation_size else: scaleB = self.scaleB vertices_list, codes_list = [], [] if self.bracketA: x0, y0 = path.vertices[0] x1, y1 = path.vertices[1] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t, self.widthA * scaleA, self.lengthA * scaleA) vertices_list.append(verticesA) codes_list.append(codesA) vertices_list.append(path.vertices) codes_list.append(path.codes) if self.bracketB: x0, y0 = path.vertices[-1] x1, y1 = path.vertices[-2] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesB, codesB = self._get_bracket(x0, y0, cos_t, sin_t, self.widthB * scaleB, self.lengthB * scaleB) vertices_list.append(verticesB) codes_list.append(codesB) vertices = np.concatenate(vertices_list) codes = np.concatenate(codes_list) p = Path(vertices, codes) return p, False
Example #9
Source File: patches.py From ImageFusion with MIT License | 4 votes |
def transmute(self, path, mutation_size, linewidth): if self.scaleA is None: scaleA = mutation_size else: scaleA = self.scaleA if self.scaleB is None: scaleB = mutation_size else: scaleB = self.scaleB vertices_list, codes_list = [], [] if self.bracketA: x0, y0 = path.vertices[0] x1, y1 = path.vertices[1] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t, self.widthA * scaleA, self.lengthA * scaleA) vertices_list.append(verticesA) codes_list.append(codesA) vertices_list.append(path.vertices) codes_list.append(path.codes) if self.bracketB: x0, y0 = path.vertices[-1] x1, y1 = path.vertices[-2] cos_t, sin_t = get_cos_sin(x1, y1, x0, y0) verticesB, codesB = self._get_bracket(x0, y0, cos_t, sin_t, self.widthB * scaleB, self.lengthB * scaleB) vertices_list.append(verticesB) codes_list.append(codesB) vertices = np.concatenate(vertices_list) codes = np.concatenate(codes_list) p = Path(vertices, codes) return p, False