Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT: Get rcParams from mpl #23676

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 1 commit into from
Aug 19, 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
17 changes: 9 additions & 8 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import numpy as np

import matplotlib as mpl
from matplotlib import _api, cbook, _docstring, _preprocess_data
import matplotlib.artist as martist
import matplotlib.axes as maxes
Expand All @@ -28,7 +29,7 @@
import matplotlib.patches as mpatches
import matplotlib.container as mcontainer
import matplotlib.transforms as mtransforms
from matplotlib.axes import Axes, rcParams
from matplotlib.axes import Axes
from matplotlib.axes._base import _axis_method_wrapper, _process_plot_format
from matplotlib.transforms import Bbox
from matplotlib.tri.triangulation import Triangulation
Expand Down Expand Up @@ -964,10 +965,10 @@ def clear(self):
# docstring inherited.
super().clear()
if self._focal_length == np.inf:
self._zmargin = rcParams['axes.zmargin']
self._zmargin = mpl.rcParams['axes.zmargin']
else:
self._zmargin = 0.
self.grid(rcParams['axes3d.grid'])
self.grid(mpl.rcParams['axes3d.grid'])

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

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

if rcParams['_internal.classic_mode']:
if mpl.rcParams['_internal.classic_mode']:
# Strides have priority over counts in classic mode.
# So, only compute strides from counts
# if counts were explicitly given
Expand Down Expand Up @@ -2965,7 +2966,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
# Make the style dict for caps (the "hats").
eb_cap_style = {**base_style, 'linestyle': 'None'}
if capsize is None:
capsize = rcParams["errorbar.capsize"]
capsize = mpl.rcParams["errorbar.capsize"]
if capsize > 0:
eb_cap_style['markersize'] = 2. * capsize
if capthick is not None:
Expand Down Expand Up @@ -3006,7 +3007,7 @@ def _extract_errs(err, data, lomask, himask):
# scene is rotated, they are given a standard size based on viewing
# them directly in planar form.
quiversize = eb_cap_style.get('markersize',
rcParams['lines.markersize']) ** 2
mpl.rcParams['lines.markersize']) ** 2
quiversize *= self.figure.dpi / 72
quiversize = self.transAxes.inverted().transform([
(0, 0), (quiversize, quiversize)])
Expand Down Expand Up @@ -3221,7 +3222,7 @@ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
# Determine style for stem lines.
linestyle, linemarker, linecolor = _process_plot_format(linefmt)
if linestyle is None:
linestyle = rcParams['lines.linestyle']
linestyle = mpl.rcParams['lines.linestyle']

# Plot everything in required order.
baseline, = self.plot(basex, basey, basefmt, zs=bottom,
Expand Down
27 changes: 14 additions & 13 deletions lib/mpl_toolkits/mplot3d/axis3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import numpy as np

import matplotlib as mpl
from matplotlib import (
_api, artist, lines as mlines, axis as maxis, patches as mpatches,
transforms as mtransforms, rcParams, colors as mcolors)
transforms as mtransforms, colors as mcolors)
from . import art3d, proj3d


Expand Down Expand Up @@ -81,15 +82,15 @@ def __init__(self, *args, **kwargs):
# This is a temporary member variable.
# Do not depend on this existing in future releases!
self._axinfo = self._AXINFO[name].copy()
if rcParams['_internal.classic_mode']:
if mpl.rcParams['_internal.classic_mode']:
self._axinfo.update({
'label': {'va': 'center', 'ha': 'center'},
'tick': {
'inward_factor': 0.2,
'outward_factor': 0.1,
'linewidth': {
True: rcParams['lines.linewidth'], # major
False: rcParams['lines.linewidth'], # minor
True: mpl.rcParams['lines.linewidth'], # major
False: mpl.rcParams['lines.linewidth'], # minor
}
},
'axisline': {'linewidth': 0.75, 'color': (0, 0, 0, 1)},
Expand All @@ -107,21 +108,21 @@ def __init__(self, *args, **kwargs):
'outward_factor': 0.1,
'linewidth': {
True: ( # major
rcParams['xtick.major.width'] if name in 'xz' else
rcParams['ytick.major.width']),
mpl.rcParams['xtick.major.width'] if name in 'xz'
else mpl.rcParams['ytick.major.width']),
False: ( # minor
rcParams['xtick.minor.width'] if name in 'xz' else
rcParams['ytick.minor.width']),
mpl.rcParams['xtick.minor.width'] if name in 'xz'
else mpl.rcParams['ytick.minor.width']),
}
},
'axisline': {
'linewidth': rcParams['axes.linewidth'],
'color': rcParams['axes.edgecolor'],
'linewidth': mpl.rcParams['axes.linewidth'],
'color': mpl.rcParams['axes.edgecolor'],
},
'grid': {
'color': rcParams['grid.color'],
'linewidth': rcParams['grid.linewidth'],
'linestyle': rcParams['grid.linestyle'],
'color': mpl.rcParams['grid.color'],
'linewidth': mpl.rcParams['grid.linewidth'],
'linestyle': mpl.rcParams['grid.linestyle'],
},
})

Expand Down