Title: Better choice of axes offset value · Issue #5755 · matplotlib/matplotlib · GitHub
Open Graph Title: Better choice of axes offset value · Issue #5755 · matplotlib/matplotlib
X Title: Better choice of axes offset value · Issue #5755 · matplotlib/matplotlib
Description: Currently, when setting xlim(1231, 1239), the offset text is "+1.231e3" and the x labels are 0, ..., 8. I would suggest switching this to +1230 and x labels being 1, ..., 9. There is a formatting issue (basically using "%g" instead of "%...
Open Graph Description: Currently, when setting xlim(1231, 1239), the offset text is "+1.231e3" and the x labels are 0, ..., 8. I would suggest switching this to +1230 and x labels being 1, ..., 9. There is a formatting i...
X Description: Currently, when setting xlim(1231, 1239), the offset text is "+1.231e3" and the x labels are 0, ..., 8. I would suggest switching this to +1230 and x labels being 1, ..., 9. There is a fo...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/5755
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Better choice of axes offset value","articleBody":"Currently, when setting `xlim(1231, 1239)`, the offset text is \"+1.231e3\" and the x labels are 0, ..., 8. I would suggest switching this to +1230 and x labels being 1, ..., 9. There is a formatting issue (basically using \"%g\" instead of \"%f\"), but I want to concentrate here on the actual value of the offset.\n\nBasically, I think a reasonable algorithm for the choice of the offset value is the following:\n(1) if xmin and xmax have the same number of digits: use the longest common prefix of their string representations, padded by zeros (e.g. xyzabc .. xyzdef =\u003e xyz000).\n(2) if they don't have the same number of digits (e.g. 9995 .. 10005), I see two possibilities: either fall back to using 9995 as base offset, or use 10000 as base offset in which case the x labels will go from -5 to +5. I tend to think the second option is better but it is true that negative labels can look weird.\n(3) note that using negative labels is also an option in case (1) if the number of zeros in the padding is \"large\" relative to the x range, e.g. 12399995 .. 12400005: it may be better to use 12400000 as base offset and have x labels from -5 to +5 rather than 12300000 as base offset and have x labels from 99995 to 100005.\n\nThoughts?\n\nRelated to #4445, #4451, #5738.\n","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2015-12-29T05:01:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/5755/matplotlib/issues/5755"}
| 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:2c4bda0d-cb7a-3211-d691-b24eaf956d4a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A076:1078DB:C785E0:109D882:6A52C45E |
| html-safe-nonce | c8f7b219d10584502267c9c4dae8a9766352584a17b8b90fec2760e37e655052 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDc2OjEwNzhEQjpDNzg1RTA6MTA5RDg4Mjo2QTUyQzQ1RSIsInZpc2l0b3JfaWQiOiI0MDQ3OTUwNjA3NDY1NzU5ODM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 02b025e6b7bc9892eb7c25a5cae6d60f249ab3d4d79397642d8ec8d718a2392d |
| hovercard-subject-tag | issue:124163935 |
| 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/5755/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bb9d9f4684a96a1c7a8ef4137fa1218b4a01ab4d84249ec9094276fd763962bc/matplotlib/matplotlib/issues/5755 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bb9d9f4684a96a1c7a8ef4137fa1218b4a01ab4d84249ec9094276fd763962bc/matplotlib/matplotlib/issues/5755 |
| og:image:alt | Currently, when setting xlim(1231, 1239), the offset text is "+1.231e3" and the x labels are 0, ..., 8. I would suggest switching this to +1230 and x labels being 1, ..., 9. There is a formatting i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width