|
8 | 8 |
|
9 | 9 | from matplotlib import (
|
10 | 10 | _api, artist, lines as mlines, axis as maxis, patches as mpatches,
|
11 |
| - transforms as mtransforms, rcParams) |
| 11 | + transforms as mtransforms, rcParams, colors as mcolors) |
12 | 12 | from . import art3d, proj3d
|
13 | 13 |
|
14 | 14 |
|
@@ -148,8 +148,7 @@ def _init3d(self):
|
148 | 148 |
|
149 | 149 | # Store dummy data in Polygon object
|
150 | 150 | self.pane = mpatches.Polygon(
|
151 |
| - np.array([[0, 0], [0, 1], [1, 0], [0, 0]]), |
152 |
| - closed=False, alpha=0.8, facecolor='k', edgecolor='k') |
| 151 | + np.array([[0, 0], [0, 1]]), closed=False) |
153 | 152 | self.set_pane_color(self._axinfo['color'])
|
154 | 153 |
|
155 | 154 | self.axes._set_artist_props(self.line)
|
@@ -182,14 +181,28 @@ def get_minor_ticks(self, numticks=None):
|
182 | 181 | obj.set_transform(self.axes.transData)
|
183 | 182 | return ticks
|
184 | 183 |
|
| 184 | + @_api.deprecated("3.6") |
185 | 185 | def set_pane_pos(self, xys):
|
| 186 | + self._set_pane_pos(xys) |
| 187 | + |
| 188 | + def _set_pane_pos(self, xys): |
186 | 189 | xys = np.asarray(xys)
|
187 | 190 | xys = xys[:, :2]
|
188 | 191 | self.pane.xy = xys
|
189 | 192 | self.stale = True
|
190 | 193 |
|
191 |
| - def set_pane_color(self, color): |
192 |
| - """Set pane color to a RGBA tuple.""" |
| 194 | + def set_pane_color(self, color, alpha=None): |
| 195 | + """ |
| 196 | + Set pane color. |
| 197 | +
|
| 198 | + Parameters |
| 199 | + ---------- |
| 200 | + color : color |
| 201 | + Color for axis pane. |
| 202 | + alpha : float, optional |
| 203 | + Alpha value for axis pane. If None, base it on *color*. |
| 204 | + """ |
| 205 | + color = mcolors.to_rgba(color, alpha) |
193 | 206 | self._axinfo['color'] = color
|
194 | 207 | self.pane.set_edgecolor(color)
|
195 | 208 | self.pane.set_facecolor(color)
|
@@ -290,7 +303,7 @@ def draw_pane(self, renderer):
|
290 | 303 | else:
|
291 | 304 | plane = self._PLANES[2 * index + 1]
|
292 | 305 | xys = [tc[p] for p in plane]
|
293 |
| - self.set_pane_pos(xys) |
| 306 | + self._set_pane_pos(xys) |
294 | 307 | self.pane.draw(renderer)
|
295 | 308 |
|
296 | 309 | renderer.close_group('pane3d')
|
|
0 commit comments