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

Skip to content

Commit 2002cb3

Browse files
committed
Added set_params() method to AsinhLocator
1 parent 2b0d588 commit 2002cb3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,14 @@ def test_set_params(self):
443443
assert sym.numticks == 8
444444

445445

446+
class TestAsinhLocator:
447+
def test_set_params(self):
448+
lctr = mticker.AsinhLocator(linear_width=5, numticks=17)
449+
assert lctr.numticks == 17
450+
lctr.set_params(numticks=23)
451+
assert lctr.numticks == 23
452+
453+
446454
class TestScalarFormatter:
447455
offset_data = [
448456
(123, 189, 0),

lib/matplotlib/ticker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
'Locator', 'IndexLocator', 'FixedLocator', 'NullLocator',
149149
'LinearLocator', 'LogLocator', 'AutoLocator',
150150
'MultipleLocator', 'MaxNLocator', 'AutoMinorLocator',
151-
'SymmetricalLogLocator', 'LogitLocator')
151+
'SymmetricalLogLocator', 'AsinhLocator', 'LogitLocator')
152152

153153

154154
class _DummyAxis:
@@ -2606,6 +2606,11 @@ def __init__(self, linear_width, numticks=12):
26062606
self.linear_width = linear_width
26072607
self.numticks = numticks
26082608

2609+
def set_params(self, numticks=None):
2610+
"""Set parameters within this locator."""
2611+
if numticks is not None:
2612+
self.numticks = numticks
2613+
26092614
def __call__(self):
26102615
dmin, dmax = self.axis.get_data_interval()
26112616
return self.tick_values(dmin, dmax)

0 commit comments

Comments
 (0)