Title: axes.locator_params fails with LogLocator (and most Locator subclasses) · Issue #3658 · matplotlib/matplotlib · GitHub
Open Graph Title: axes.locator_params fails with LogLocator (and most Locator subclasses) · Issue #3658 · matplotlib/matplotlib
X Title: axes.locator_params fails with LogLocator (and most Locator subclasses) · Issue #3658 · matplotlib/matplotlib
Description: 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....
Open Graph Description: 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 ...
X Description: 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(...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/3658
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"axes.locator_params fails with LogLocator (and most Locator subclasses)","articleBody":"There is a \"communication\" issue between the `axes.locator_params` and the `LogLocator` class:\n\n``` python\nplt_scale = 'log'\n#plt_scale = 'linear'\n\nfig, (ax1) = plt.subplots(1, 1)\n\nax1.set(yscale=plt_scale)\n\n# works for linear scale, not for log:\nax1.axes.locator_params('y', nbins=5)\n```\n\nResult:\n\n```\nAttributeError Traceback (most recent call last)\n\u003cipython-input-74-3492af5f93c8\u003e in \u003cmodule\u003e()\n 7\n 8 # works for linear scale, not for log:\n----\u003e 9 ax1.axes.locator_params('y', nbins=5)\n\n/home/pierre/anaconda/lib/python2.7/site-packages/matplotlib/axes.pyc in locator_params(self, axis, tight, **kwargs)\n 2305 self.xaxis.get_major_locator().set_params(**kwargs)\n 2306 if _y:\n-\u003e 2307 self.yaxis.get_major_locator().set_params(**kwargs)\n 2308 self.autoscale_view(tight=tight, scalex=_x, scaley=_y)\n 2309\n\nAttributeError: 'LogLocator' object has no attribute 'set_params'\n```\n\nWhat 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. (`set_params` is indeed defined in `MaxNLocator` https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/ticker.py#L1297)\n\nSo my question is: shouldn't all `Locator` subclasses have a `set_params` method ?\n\n(and then, my code example could raise a _different error_, or maybe a _warning_, complaining that `LogLocator` makes in fact no use of an `nbins` parameter!)\n\nbest,\nPierre\n","author":{"url":"https://github.com/pierre-haessig","@type":"Person","name":"pierre-haessig"},"datePublished":"2014-10-17T14:00:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/3658/matplotlib/issues/3658"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:37d1d9f8-52dc-0ac0-a8b3-6c2ebd0e2d74 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A584:2BA6B2:3E7A5F8:586315F:6A56D56D |
| html-safe-nonce | f8b17cbe2c32b48da736a0960862a72f1c1180743aed35f78aa8f802ae104179 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTg0OjJCQTZCMjozRTdBNUY4OjU4NjMxNUY6NkE1NkQ1NkQiLCJ2aXNpdG9yX2lkIjoiODMzOTUzMjIwMjIyMTQyNjAyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 310c9817aebda4906fb64519140fc605c20bfafe6542a9e00394fc7de2865a0c |
| hovercard-subject-tag | issue:46102309 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/3658/issue_layout |
| twitter:image | https://opengraph.githubassets.com/514c117d9b570165cc11c4e3cb0d9bc8afbfb15e4b2e1e6f0e579ee49b4ad23b/matplotlib/matplotlib/issues/3658 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/514c117d9b570165cc11c4e3cb0d9bc8afbfb15e4b2e1e6f0e579ee49b4ad23b/matplotlib/matplotlib/issues/3658 |
| og:image:alt | 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pierre-haessig |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5220a278731283038daf0ed00b41f06ef7ff9539020ecc806c5c5a0fb6bda25a |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 952dc124c1d105aa6fc49def04bb458db95747d7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width