8000 Merge pull request #23647 from oscargus/mplot3dfixes · matplotlib/matplotlib@285adc5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 285adc5

Browse files
authored
Merge pull request #23647 from oscargus/mplot3dfixes
Allow any color format to be used for axis3d.Axis.set_pane_color
2 parents 944b99a + f2715a1 commit 285adc5

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
``mplot3d.axis3d.Axis.set_pane_pos``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is deprecated. This is an internal method where the provided values are
5+
overwritten during drawing. Hence, it does not serve any purpose to be
6+
directly accessible.

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from matplotlib import (
1010
_api, artist, lines as mlines, axis as maxis, patches as mpatches,
11-
transforms as mtransforms, rcParams)
11+
transforms as mtransforms, rcParams, colors as mcolors)
1212
from . import art3d, proj3d
1313

1414

@@ -148,8 +148,7 @@ def _init3d(self):
148148

149149
# Store dummy data in Polygon object
150150
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)
153152
self.set_pane_color(self._axinfo['color'])
154153

155154
self.axes._set_artist_props(self.line)
@@ -182,14 +181,28 @@ def get_minor_ticks(self, numticks=None):
182181
obj.set_transform(self.axes.transData)
183182
return ticks
184183

184+
@_api.deprecated("3.6")
185185
def set_pane_pos(self, xys):
186+
self._set_pane_pos(xys)
187+
188+
def _set_pane_pos(self, xys):
186189
xys = np.asarray(xys)
187190
xys = xys[:, :2]
188191
self.pane.xy = xys
189192
self.stale = True
190193

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)
193206
self._axinfo['color'] = color
194207
self.pane.set_edgecolor(color)
195208
self.pane.set_facecolor(color)
@@ -290,7 +303,7 @@ def draw_pane(self, renderer):
290303
else:
291304
plane = self._PLANES[2 * index + 1]
292305
xys = [tc[p] for p in plane]
293-
self.set_pane_pos(xys)
306+
self._set_pane_pos(xys)
294307
self.pane.draw(renderer)
295308

296309
renderer.close_group('pane3d')

0 commit comments

Comments
 (0)
0