You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
axes.locator_params fails with LogLocator (and most Locator subclasses) #3658
There is a "communication" issue between the axes.locator_params and the LogLocator class:
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'
Would you be interested in doing this generalization? The easiest path would be to add a set_params to Locator that is a no-op + warning (so the code stops dying!) and then to add sensible implementations to each of the Locator classes.
Activity
tacaswell commentedon Oct 17, 2014
Thanks for the bug report.
It turns out that only the
MaxNLocater(and its sub-classAutoLocator) haveset_params. This limitation is noted in the docstring (http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.locator_params).Would you be interested in doing this generalization? The easiest path would be to add a
set_paramstoLocatorthat is a no-op + warning (so the code stops dying!) and then to add sensible implementations to each of theLocatorclasses.pierre-haessig commentedon Oct 30, 2014
Interested, yes, but I don't have a proper time window for doing the work... :-(
Should this be marked with 'API consistency' and 'low hanging fruit' labels ?
efiring commentedon Oct 30, 2014
Good idea. Done.
Merge pull request #4172 from ryanbelt/master
tacaswell commentedon Feb 15, 2016
Closed by #4172 / #4191