10000 Allow any color format to be used for axis3d.Axis.set_pane_color by oscargus · Pull Request #23647 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Allow any color format to be used for axis3d.Axis.set_pane_color #23647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/api/next_api_changes/deprecations/23647-OG.rst
Original file line number Diff line number Diff line change
@@ -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.
25 changes: 19 additions & 6 deletions lib/mpl_toolkits/mplot3d/axis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down
0