Examples of parameter renames. · matplotlib/matplotlib@77d5e8e · GitHub
Skip to content

Commit 77d5e8e

Browse files
committed
Examples of parameter renames.
1 parent 5c6b096 commit 77d5e8e

5 files changed

Lines changed: 34 additions & 16 deletions

File tree

Lines changed: 11 additions & 0 deletions

lib/matplotlib/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,13 +1183,14 @@ def __exit__(self, exc_type, exc_value, exc_tb):
11831183
self.__fallback()
11841184

11851185

1186-
def use(arg, warn=False, force=True):
1186+
@cbook._rename_parameter("3.1", "arg", "backend")
1187+
def use(backend, warn=False, force=True):
11871188
"""
11881189
Set the matplotlib backend to one of the known backends.
11891190
11901191
Parameters
11911192
----------
1192-
arg : str
1193+
backend : str
11931194
The backend to switch to. This can either be one of the
11941195
'standard' backend names:
11951196
@@ -1205,6 +1206,8 @@ def use(arg, warn=False, force=True):
12051206
12061207
Note: Standard backend names are case-insensitive here.
12071208
1209+
*arg* is a deprecated synonym for this parameter.
1210+
12081211
warn : bool, optional
12091212
If True, warn if this is called after pyplot has been imported
12101213
and a backend is set up.
@@ -1221,7 +1224,7 @@ def use(arg, warn=False, force=True):
12211224
:ref:`backends`
12221225
matplotlib.get_backend
12231226
"""
1224-
name = validate_backend(arg)
1227+
name = validate_backend(backend)
12251228

12261229
# if setting back to the same thing, do nothing
12271230
if (dict.__getitem__(rcParams, 'backend') == name):

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6845,7 +6845,8 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
68456845
return tops, bins, cbook.silent_list('Lists of Patches', patches)
68466846

68476847
@_preprocess_data(replace_names=["x", "y", "weights"])
6848-
def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
6848+
@cbook._rename_parameter("3.1", "normed", "density")
6849+
def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
68496850
cmin=None, cmax=None, **kwargs):
68506851
"""
68516852
Make a 2D histogram plot.
@@ -6879,8 +6880,9 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
68796880
xmax], [ymin, ymax]]``. All values outside of this range will be
68806881
considered outliers and not tallied in the histogram.
68816882
6882-
normed : bool, optional, default: False
6883-
Normalize histogram.
6883+
density : bool, optional, default: False
6884+
Normalize histogram. *normed* is a deprecated synonym for this
6885+
parameter.
68846886
68856887
weights : array_like, shape (n, ), optional, default: None
68866888
An array of values w_i weighing each sample (x_i, y_i).
@@ -6939,7 +6941,7 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
69396941
"""
69406942

69416943
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
6942-
normed=normed, weights=weights)
6944+
normed=density, weights=weights)
69436945

69446946
if cmin is not None:
69456947
h[h < cmin] = None

lib/matplotlib/pyplot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,12 +2632,12 @@ def hist(
26322632
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26332633
@_autogen_docstring(Axes.hist2d)
26342634
def hist2d(
2635-
x, y, bins=10, range=None, normed=False, weights=None,
2635+
x, y, bins=10, range=None, density=False, weights=None,
26362636
cmin=None, cmax=None, *, data=None, **kwargs):
26372637
__ret = gca().hist2d(
2638-
x, y, bins=bins, range=range, normed=normed, weights=weights,
2639-
cmin=cmin, cmax=cmax, **({"data": data} if data is not None
2640-
else {}), **kwargs)
2638+
x, y, bins=bins, range=range, density=density,
2639+
weights=weights, cmin=cmin, cmax=cmax, **({"data": data} if
2640+
data is not None else {}), **kwargs)
26412641
sci(__ret[-1])
26422642
return __ret
26432643

lib/matplotlib/text.py

Lines changed: 7 additions & 5 deletions

0 commit comments

Comments
 (0)