Skip to content
Prev Previous commit
Next Next commit
Rebased to latest master. Added set_params to new LogitLocator. Added…
… testing functions to test_ticker.py
  • Loading branch information
leeonadoh committed Mar 3, 2015
commit 27fbe7e8ef5521e8fa9eaea665cc8a1cff69da26
9 changes: 9 additions & 0 deletions lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ def test_MultipleLocator_set_params():
mult.set_params(base=1.7)
nose.tools.assert_equal(mult._base, 1.7)

def test_LogitLocator_set_params():
"""
Create logit locator with default minor=False, and change it to something
else. See if change was successful. Should not exception.
"""
loc = mticker.LogitLocator() # Defaults to false.
loc.set_params(minor=True)
nose.tools.assert_true(loc.minor)


def test_FixedLocator_set_params():
"""
Expand Down
5 changes: 5 additions & 0 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,11 @@ def __init__(self, minor=False):
"""
self.minor = minor

def set_params(self, minor=None):
"""Set parameters within this locator."""
if minor is not None:
self.minor = minor

def __call__(self):
'Return the locations of the ticks'
vmin, vmax = self.axis.get_view_interval()
Expand Down