MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / PathEffectRenderer

Class PathEffectRenderer

site-packages/matplotlib/patheffects.py:71–160  ·  view source on GitHub ↗

Implements a Renderer which contains another renderer. This proxy then intercepts draw calls, calling the appropriate :class:`AbstractPathEffect` draw method. .. note:: Not all methods have been overridden on this RendererBase subclass. It may be necessary to add f

Source from the content-addressed store, hash-verified

69
70
71class PathEffectRenderer(RendererBase):
72 """
73 Implements a Renderer which contains another renderer.
74
75 This proxy then intercepts draw calls, calling the appropriate
76 :class:`AbstractPathEffect` draw method.
77
78 .. note::
79 Not all methods have been overridden on this RendererBase subclass.
80 It may be necessary to add further methods to extend the PathEffects
81 capabilities further.
82
83 """
84 def __init__(self, path_effects, renderer):
85 """
86 Parameters
87 ----------
88 path_effects : iterable of :class:`AbstractPathEffect`
89 The path effects which this renderer represents.
90 renderer : :class:`matplotlib.backend_bases.RendererBase` instance
91
92 """
93 self._path_effects = path_effects
94 self._renderer = renderer
95
96 def new_gc(self):
97 return self._renderer.new_gc()
98
99 def copy_with_path_effect(self, path_effects):
100 return self.__class__(path_effects, self._renderer)
101
102 def draw_path(self, gc, tpath, affine, rgbFace=None):
103 for path_effect in self._path_effects:
104 path_effect.draw_path(self._renderer, gc, tpath, affine,
105 rgbFace)
106
107 def draw_markers(self, gc, marker_path, marker_trans, path, *args,
108 **kwargs):
109 # We do a little shimmy so that all markers are drawn for each path
110 # effect in turn. Essentially, we induce recursion (depth 1) which is
111 # terminated once we have just a single path effect to work with.
112 if len(self._path_effects) == 1:
113 # Call the base path effect function - this uses the unoptimised
114 # approach of calling "draw_path" multiple times.
115 return RendererBase.draw_markers(self, gc, marker_path,
116 marker_trans, path, *args,
117 **kwargs)
118
119 for path_effect in self._path_effects:
120 renderer = self.copy_with_path_effect([path_effect])
121 # Recursively call this method, only next time we will only have
122 # one path effect.
123 renderer.draw_markers(gc, marker_path, marker_trans, path,
124 *args, **kwargs)
125
126 def draw_path_collection(self, gc, master_transform, paths, *args,
127 **kwargs):
128 # We do a little shimmy so that all paths are drawn for each path

Callers 5

drawMethod · 0.90
drawMethod · 0.90
drawMethod · 0.90
drawMethod · 0.90
drawMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected