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

Skip to content

Commit 12a3bd5

Browse files
committed
Expire deprecation of passing nbins to MaxNLocator in two ways
1 parent 831a13c commit 12a3bd5

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MaxNLocator passing *nbins* in two ways
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
`~.ticker.MaxNLocator` does not accept a positional parameter and the keyword
4+
argument *nbins* simultaneously because they specify the same quantity.

lib/matplotlib/ticker.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ class MaxNLocator(Locator):
19871987
prune=None,
19881988
min_n_ticks=2)
19891989

1990-
def __init__(self, *args, **kwargs):
1990+
def __init__(self, nbins=None, **kwargs):
19911991
"""
19921992
Parameters
19931993
----------
@@ -2024,17 +2024,8 @@ def __init__(self, *args, **kwargs):
20242024
Relax *nbins* and *integer* constraints if necessary to obtain
20252025
this minimum number of ticks.
20262026
"""
2027-
if args:
2028-
if 'nbins' in kwargs:
2029-
_api.deprecated("3.1",
2030-
message='Calling MaxNLocator with positional '
2031-
'and keyword parameter *nbins* is '
2032-
'considered an error and will fail '
2033-
'in future versions of matplotlib.')
2034-
kwargs['nbins'] = args[0]
2035-
if len(args) > 1:
2036-
raise ValueError(
2037-
"Keywords are required for all arguments except 'nbins'")
2027+
if nbins is not None:
2028+
kwargs['nbins'] = nbins
20382029
self.set_params(**{**self.default_params, **kwargs})
20392030

20402031
@staticmethod

0 commit comments

Comments
 (0)