'LogLocator' object has no attribute 'set_params'

Hello,

I was wondering if the following behavior is a bug of LogLocator

class or just a known limitation:
(mpl 1.3.1)

Input:

plt_scale = ‘log’

  #plt_scale = 'linear'



  fig, (ax1) = plt.subplots(1, 1)



  ax1.set(yscale=plt_scale)



  # works for linear scale, not for log:

  ax1.axes.locator_params('y', nbins=5)
Result:
  AttributeError                            Traceback

(most recent call last)

  <ipython-input-74-3492af5f93c8> in <module>()

        7

        8 # works for linear scale, not for log:

  ----> 9 ax1.axes.locator_params('y', nbins=5)



  /home/pierre/anaconda/lib/python2.7/site-packages/matplotlib/axes.pyc

in locator_params(self, axis, tight, **kwargs)

     2305            

self.xaxis.get_major_locator().set_params(**kwargs)

     2306         if _y:

  -> 2307            

self.yaxis.get_major_locator().set_params(**kwargs)

     2308         self.autoscale_view(tight=tight, scalex=_x,

scaley=_y)

     2309



  AttributeError: 'LogLocator' object has no attribute 'set_params'
What I get from the traceback is that `locator_params` method

forwards the locator attributes (in my case nbins) to the actual
locator object via its set_params method. And this method is
missing from LogLocator

So my question is: shouldn't all Locator subclasses have a

set_params method ?

best,

Pierre

(set_params is indeed defined in MaxNLocator

)

···

https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/ticker.py#L1297

Hi,

···

Le 08/10/2014 15:04, Pierre Haessig a écrit :

[…]

  AttributeError: 'LogLocator' object has no attribute 'set_params'

  [...]

Should I put an issue on Github ?

best,

Pierre

Yes, please do.

···

On Wed, Oct 15, 2014 at 4:55 AM, Pierre Haessig <pierre.haessig@…804…> wrote:

Hi,

Le 08/10/2014 15:04, Pierre Haessig a écrit :

[…]

  AttributeError: 'LogLocator' object has no attribute 'set_params'

  [...]

Should I put an issue on Github ?

best,

Pierre

Comprehensive Server Monitoring with Site24x7.

Monitor 10 servers for $9/Month.

Get alerted through email, SMS, voice calls or mobile push notifications.

Take corrective actions from your mobile device.

http://p.sf.net/sfu/Zoho


Matplotlib-devel mailing list

Matplotlib-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-devel