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

Skip to content
Next Next commit
bug fix, adding set_param to the locators
  • Loading branch information
ryanbelt authored and leeonadoh committed Mar 3, 2015
commit 67753275a1ab07547f67392ece193d81ea6687fd
30 changes: 30 additions & 0 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,12 @@ def __init__(self, base, offset):
self._base = base
self.offset = offset

def set_params(self, **kwargs):
if 'base' in kwargs:
self.base = kwargs['base']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this has to be _base with an underscore; or remove the underscore elsewhere in this class.

if 'offset' in kwargs:
self.offset = kwargs['offset']

def __call__(self):
"""Return the locations of the ticks"""
dmin, dmax = self.axis.get_data_interval()
Expand Down Expand Up @@ -1052,6 +1058,10 @@ def __init__(self, locs, nbins=None):
if self.nbins is not None:
self.nbins = max(self.nbins, 2)

def set_params(self, **kwargs):
if 'nbins' in kwargs:
self.nbins = kwargs['nbins']

def __call__(self):
return self.tick_values(None, None)

Expand Down Expand Up @@ -1116,6 +1126,12 @@ def __init__(self, numticks=None, presets=None):
else:
self.presets = presets

def set_params(self, **kwargs):
if 'presets' in kwargs:
self.presets = kwargs['presets']
if 'numticks' in kwargs:
self.numticks = kwargs['numticks']

def __call__(self):
'Return the locations of the ticks'
vmin, vmax = self.axis.get_view_interval()
Expand Down Expand Up @@ -1218,6 +1234,10 @@ class MultipleLocator(Locator):
def __init__(self, base=1.0):
self._base = Base(base)

def set_params(self, **kwargs):
if 'base' in kwargs:
self.base = kwargs['base']

def __call__(self):
'Return the locations of the ticks'
vmin, vmax = self.axis.get_view_interval()
Expand Down Expand Up @@ -1453,6 +1473,16 @@ def __init__(self, base=10.0, subs=[1.0], numdecs=4, numticks=15):
self.numticks = numticks
self.numdecs = numdecs

def set_params(self, **kwargs):
if 'base' in kwargs:
self.base = kwargs['base']
if 'subs' in kwargs:
self.subs = kwargs['subs']
if 'numdecs' in kwargs:
self.numdecs = kwargs['numdecs']
if 'numticks' in kwargs:
self.numticks = kwargs['numticks']

def base(self, base):
"""
set the base of the log scaling (major tick every base**i, i integer)
Expand Down