diff --git a/doc/api/next_api_changes/deprecations/23647-OG.rst b/doc/api/next_api_changes/deprecations/23647-OG.rst new file mode 100644 index 000000000000..ee44f491812f --- /dev/null +++ b/doc/api/next_api_changes/deprecations/23647-OG.rst @@ -0,0 +1,6 @@ +``mplot3d.axis3d.Axis.set_pane_pos`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... is deprecated. This is an internal method where the provided values are +overwritten during drawing. Hence, it does not serve any purpose to be +directly accessible. diff --git a/lib/mpl_toolkits/mplot3d/axis3d.py b/lib/mpl_toolkits/mplot3d/axis3d.py index fff4a4f71701..65e268461d98 100644 --- a/lib/mpl_toolkits/mplot3d/axis3d.py +++ b/lib/mpl_toolkits/mplot3d/axis3d.py @@ -8,7 +8,7 @@ from matplotlib import ( _api, artist, lines as mlines, axis as maxis, patches as mpatches, - transforms as mtransforms, rcParams) + transforms as mtransforms, rcParams, colors as mcolors) from . import art3d, proj3d @@ -148,8 +148,7 @@ def _init3d(self): # Store dummy data in Polygon object self.pane = mpatches.Polygon( - np.array([[0, 0], [0, 1], [1, 0], [0, 0]]), - closed=False, alpha=0.8, facecolor='k', edgecolor='k') + np.array([[0, 0], [0, 1]]), closed=False) self.set_pane_color(self._axinfo['color']) self.axes._set_artist_props(self.line) @@ -182,14 +181,28 @@ def get_minor_ticks(self, numticks=None): obj.set_transform(self.axes.transData) return ticks + @_api.deprecated("3.6") def set_pane_pos(self, xys): + self._set_pane_pos(xys) + + def _set_pane_pos(self, xys): xys = np.asarray(xys) xys = xys[:, :2] self.pane.xy = xys self.stale = True - def set_pane_color(self, color): - """Set pane color to a RGBA tuple.""" + def set_pane_color(self, color, alpha=None): + """ + Set pane color. + + Parameters + ---------- + color : color + Color for axis pane. + alpha : float, optional + Alpha value for axis pane. If None, base it on *color*. + """ + color = mcolors.to_rgba(color, alpha) self._axinfo['color'] = color self.pane.set_edgecolor(color) self.pane.set_facecolor(color) @@ -290,7 +303,7 @@ def draw_pane(self, renderer): else: plane = self._PLANES[2 * index + 1] xys = [tc[p] for p in plane] - self.set_pane_pos(xys) + self._set_pane_pos(xys) self.pane.draw(renderer) renderer.close_group('pane3d')