Title: [Bug]: ScalarFormatter can't be forced to use an offset of 1 · Issue #29532 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: ScalarFormatter can't be forced to use an offset of 1 · Issue #29532 · matplotlib/matplotlib
X Title: [Bug]: ScalarFormatter can't be forced to use an offset of 1 · Issue #29532 · matplotlib/matplotlib
Description: Bug summary The ScalarFormatter class takes an argument useOffset, either True, which will determine an automatic offset, False, which disables an offset or an numeric value, which is the used as an offset. Since in python 1 == True --> ...
Open Graph Description: Bug summary The ScalarFormatter class takes an argument useOffset, either True, which will determine an automatic offset, False, which disables an offset or an numeric value, which is the used as a...
X Description: Bug summary The ScalarFormatter class takes an argument useOffset, either True, which will determine an automatic offset, False, which disables an offset or an numeric value, which is the used as a...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/29532
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: ScalarFormatter can't be forced to use an offset of 1","articleBody":"### Bug summary\n\nThe ScalarFormatter class takes an argument useOffset, either True, which will determine an automatic offset, False, which disables an offset or an numeric value, which is the used as an offset.\nSince in python 1 == True --\u003e True, trying to pass a numeric offset value of 1 just enables the automatic offset.\n\nhttps://matplotlib.org/stable/api/ticker_api.html#matplotlib.ticker.ScalarFormatter\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\nimport numpy as np\nfrom matplotlib.ticker import ScalarFormatter\n\n# Sample data\nx = np.linspace(0, 10, 100)\ny = np.linspace(0.999, 1.001, 100)\n\n# Create the plot\nfig, ax = plt.subplots()\nax.plot(x, y)\n\nformatter = ScalarFormatter()\nformatter.set_useOffset(1)\n# identical to formatter = ScalarFormatter(useOffset=1)\nax.yaxis.set_major_formatter(formatter)\n\nplt.show()\n```\n\n### Actual outcome\n\n\n\n### Expected outcome\n\nThe y-Axis should be centered around zero, the expected offset of 1 is not used\n\n### Additional information\n\nHappens only for useOffset = 1.\nIf the y values are changed (i.e. y = np.linspace(0.99999, 1.00001, 100)), the automatic offset actually uses an offset of 1, so the bug is not obvious then.\n\n### Operating system\n\nWin 11\n\n### Matplotlib Version\n\n3.7.2\n\n### Matplotlib Backend\n\nmodule://matplotlib_inline.backend_inline\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n6.5.4\n\n### Installation\n\nconda","author":{"url":"https://github.com/FelixKeiser","@type":"Person","name":"FelixKeiser"},"datePublished":"2025-01-28T08:46:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/29532/matplotlib/issues/29532"}
| 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:6d6f6a32-502b-cd63-12ea-c2e65f9aaaba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA4E:199219:16AAD4F:1DCDA24:6A51C423 |
| html-safe-nonce | 7cd5298bafe147d754e9a49c332cb3d029a68e11b3f3ed8094eb334aa9206469 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTRFOjE5OTIxOToxNkFBRDRGOjFEQ0RBMjQ6NkE1MUM0MjMiLCJ2aXNpdG9yX2lkIjoiNTM1MTg4MDk3NjA2MTU0NzU1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3ddcf76a46d669598dd84d447a325e0e69c09b225f4ddd1ba2594b65151559d6 |
| hovercard-subject-tag | issue:2814982358 |
| 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/29532/issue_layout |
| twitter:image | https://opengraph.githubassets.com/75b2b85c8be652363db26575acb837da77311bd65e4df1ebe5cfe03fa02dead3/matplotlib/matplotlib/issues/29532 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/75b2b85c8be652363db26575acb837da77311bd65e4df1ebe5cfe03fa02dead3/matplotlib/matplotlib/issues/29532 |
| og:image:alt | Bug summary The ScalarFormatter class takes an argument useOffset, either True, which will determine an automatic offset, False, which disables an offset or an numeric value, which is the used as a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | FelixKeiser |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width