|
99 | 99 | from matplotlib.patches import PathPatch |
100 | 100 | from matplotlib.path import Path |
101 | 101 | from matplotlib.transforms import ( |
102 | | - Affine2D, Bbox, IdentityTransform, ScaledTranslation, TransformedPath) |
| 102 | + Affine2D, Bbox, IdentityTransform, ScaledTranslation) |
103 | 103 |
|
104 | 104 | from .axisline_style import AxislineStyle |
105 | 105 |
|
106 | 106 |
|
107 | | -@cbook.deprecated("3.2", alternative="matplotlib.patches.PathPatch") |
108 | | -class BezierPath(Line2D): |
109 | | - |
110 | | - def __init__(self, path, *args, **kwargs): |
111 | | - """ |
112 | | - Parameters |
113 | | - ---------- |
114 | | - path : `~.path.Path` |
115 | | - The path to draw. |
116 | | - **kwargs |
117 | | - All remaining keyword arguments are passed to `.Line2D`. |
118 | | - """ |
119 | | - super().__init__([], [], *args, **kwargs) |
120 | | - self._path = path |
121 | | - self._invalid = False |
122 | | - |
123 | | - def recache(self): |
124 | | - self._transformed_path = TransformedPath( |
125 | | - self._path, self.get_transform()) |
126 | | - self._invalid = False |
127 | | - |
128 | | - def set_path(self, path): |
129 | | - self._path = path |
130 | | - self._invalid = True |
131 | | - |
132 | | - def draw(self, renderer): |
133 | | - if self._invalid: |
134 | | - self.recache() |
135 | | - |
136 | | - if not self._visible: |
137 | | - return |
138 | | - renderer.open_group('line2d', gid=self.get_gid()) |
139 | | - |
140 | | - gc = renderer.new_gc() |
141 | | - self._set_gc_clip(gc) |
142 | | - |
143 | | - gc.set_foreground(self._color) |
144 | | - gc.set_antialiased(self._antialiased) |
145 | | - gc.set_linewidth(self._linewidth) |
146 | | - gc.set_alpha(self._alpha) |
147 | | - if self.is_dashed(): |
148 | | - cap = self._dashcapstyle |
149 | | - join = self._dashjoinstyle |
150 | | - else: |
151 | | - cap = self._solidcapstyle |
152 | | - join = self._solidjoinstyle |
153 | | - gc.set_joinstyle(join) |
154 | | - gc.set_capstyle(cap) |
155 | | - gc.set_dashes(self._dashOffset, self._dashSeq) |
156 | | - |
157 | | - if self._lineStyles[self._linestyle] != '_draw_nothing': |
158 | | - tpath, affine = ( |
159 | | - self._transformed_path.get_transformed_path_and_affine()) |
160 | | - renderer.draw_path(gc, tpath, affine.frozen()) |
161 | | - |
162 | | - gc.restore() |
163 | | - renderer.close_group('line2d') |
164 | | - |
165 | | - |
166 | 107 | class AttributeCopier: |
167 | | - @cbook.deprecated("3.2") |
168 | | - def __init__(self, ref_artist, klass=martist.Artist): |
169 | | - self._klass = klass |
170 | | - self._ref_artist = ref_artist |
171 | | - super().__init__() |
172 | | - |
173 | | - @cbook.deprecated("3.2") |
174 | | - def set_ref_artist(self, artist): |
175 | | - self._ref_artist = artist |
176 | | - |
177 | 108 | def get_ref_artist(self): |
178 | 109 | """ |
179 | 110 | Return the underlying artist that actually defines some properties |
180 | 111 | (e.g., color) of this artist. |
181 | 112 | """ |
182 | 113 | raise RuntimeError("get_ref_artist must overridden") |
183 | 114 |
|
184 | | - @cbook._delete_parameter("3.2", "default_value") |
185 | | - def get_attribute_from_ref_artist(self, attr_name, default_value=None): |
| 115 | + def get_attribute_from_ref_artist(self, attr_name): |
186 | 116 | getter = methodcaller("get_" + attr_name) |
187 | 117 | prop = getter(super()) |
188 | 118 | return getter(self.get_ref_artist()) if prop == "auto" else prop |
|
0 commit comments