Skip to content

Commit 8cbc5e0

Browse files
committed
MNT: Get rcParams from mpl
1 parent 04d4ace commit 8cbc5e0

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import numpy as np
2020

21+
import matplotlib as mpl
2122
from matplotlib import _api, cbook, _docstring, _preprocess_data
2223
import matplotlib.artist as martist
2324
import matplotlib.axes as maxes
@@ -28,7 +29,7 @@
2829
import matplotlib.patches as mpatches
2930
import matplotlib.container as mcontainer
3031
import matplotlib.transforms as mtransforms
31-
from matplotlib.axes import Axes, rcParams
32+
from matplotlib.axes import Axes
3233
from matplotlib.axes._base import _axis_method_wrapper, _process_plot_format
3334
from matplotlib.transforms import Bbox
3435
from matplotlib.tri.triangulation import Triangulation
@@ -964,10 +965,10 @@ def clear(self):
964965
# docstring inherited.
965966
super().clear()
966967
if self._focal_length == np.inf:
967-
self._zmargin = rcParams['axes.zmargin']
968+
self._zmargin = mpl.rcParams['axes.zmargin']
968969
else:
969970
self._zmargin = 0.
970-
self.grid(rcParams['axes3d.grid'])
971+
self.grid(mpl.rcParams['axes3d.grid'])
971972

972973
def _button_press(self, event):
973974
if event.inaxes == self:
@@ -1394,7 +1395,7 @@ def plot_surface(self, X, Y, Z, *, norm=None, vmin=None,
13941395
rcount = kwargs.pop('rcount', 50)
13951396
ccount = kwargs.pop('ccount', 50)
13961397

1397-
if rcParams['_internal.classic_mode']:
1398+
if mpl.rcParams['_internal.classic_mode']:
13981399
# Strides have priority over counts in classic mode.
13991400
# So, only compute strides from counts
14001401
# if counts were explicitly given
@@ -1640,7 +1641,7 @@ def plot_wireframe(self, X, Y, Z, **kwargs):
16401641
rcount = kwargs.pop('rcount', 50)
16411642
ccount = kwargs.pop('ccount', 50)
16421643

1643-
if rcParams['_internal.classic_mode']:
1644+
if mpl.rcParams['_internal.classic_mode']:
16441645
# Strides have priority over counts in classic mode.
16451646
# So, only compute strides from counts
16461647
# if counts were explicitly given
@@ -2965,7 +2966,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
29652966
# Make the style dict for caps (the "hats").
29662967
eb_cap_style = {**base_style, 'linestyle': 'None'}
29672968
if capsize is None:
2968-
capsize = rcParams["errorbar.capsize"]
2969+
capsize = mpl.rcParams["errorbar.capsize"]
29692970
if capsize > 0:
29702971
eb_cap_style['markersize'] = 2. * capsize
29712972
if capthick is not None:
@@ -3006,7 +3007,7 @@ def _extract_errs(err, data, lomask, himask):
30063007
# scene is rotated, they are given a standard size based on viewing
30073008
# them directly in planar form.
30083009
quiversize = eb_cap_style.get('markersize',
3009-
rcParams['lines.markersize']) ** 2
3010+
mpl.rcParams['lines.markersize']) ** 2
30103011
quiversize *= self.figure.dpi / 72
30113012
quiversize = self.transAxes.inverted().transform([
30123013
(0, 0), (quiversize, quiversize)])
@@ -3221,7 +3222,7 @@ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
32213222
# Determine style for stem lines.
32223223
linestyle, linemarker, linecolor = _process_plot_format(linefmt)
32233224
if linestyle is None:
3224-
linestyle = rcParams['lines.linestyle']
3225+
linestyle = mpl.rcParams['lines.linestyle']
32253226

32263227
# Plot everything in required order.
32273228
baseline, = self.plot(basex, basey, basefmt, zs=bottom,

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
import numpy as np
88

9+
import matplotlib as mpl
910
from matplotlib import (
1011
_api, artist, lines as mlines, axis as maxis, patches as mpatches,
11-
transforms as mtransforms, rcParams, colors as mcolors)
12+
transforms as mtransforms, colors as mcolors)
1213
from . import art3d, proj3d
1314

1415

@@ -81,15 +82,15 @@ def __init__(self, *args, **kwargs):
8182
# This is a temporary member variable.
8283
# Do not depend on this existing in future releases!
8384
self._axinfo = self._AXINFO[name].copy()
84-
if rcParams['_internal.classic_mode']:
85+
if mpl.rcParams['_internal.classic_mode']:
8586
self._axinfo.update({
8687
'label': {'va': 'center', 'ha': 'center'},
8788
'tick': {
8889
'inward_factor': 0.2,
8990
'outward_factor': 0.1,
9091
'linewidth': {
91-
True: rcParams['lines.linewidth'], # major
92-
False: rcParams['lines.linewidth'], # minor
92+
True: mpl.rcParams['lines.linewidth'], # major
93+
False: mpl.rcParams['lines.linewidth'], # minor
9394
}
9495
},
9596
'axisline': {'linewidth': 0.75, 'color': (0, 0, 0, 1)},
@@ -107,21 +108,21 @@ def __init__(self, *args, **kwargs):
107108
'outward_factor': 0.1,
108109
'linewidth': {
109110
True: ( # major
110-
rcParams['xtick.major.width'] if name in 'xz' else
111-
rcParams['ytick.major.width']),
111+
mpl.rcParams['xtick.major.width'] if name in 'xz'
112+
else mpl.rcParams['ytick.major.width']),
112113
False: ( # minor
113-
rcParams['xtick.minor.width'] if name in 'xz' else
114-
rcParams['ytick.minor.width']),
114+
mpl.rcParams['xtick.minor.width'] if name in 'xz'
115+
else mpl.rcParams['ytick.minor.width']),
115116
}
116117
},
117118
'axisline': {
118-
'linewidth': rcParams['axes.linewidth'],
119-
'color': rcParams['axes.edgecolor'],
119+
'linewidth': mpl.rcParams['axes.linewidth'],
120+
'color': mpl.rcParams['axes.edgecolor'],
120121
},
121122
'grid': {
122-
'color': rcParams['grid.color'],
123-
'linewidth': rcParams['grid.linewidth'],
124-
'linestyle': rcParams['grid.linestyle'],
123+
'color': mpl.rcParams['grid.color'],
124+
'linewidth': mpl.rcParams['grid.linewidth'],
125+
'linestyle': mpl.rcParams['grid.linestyle'],
125126
},
126127
})
127128

0 commit comments

Comments
 (0)