Title: Boxplot resets x-axis limits and ticks · Issue #2921 · matplotlib/matplotlib · GitHub
Open Graph Title: Boxplot resets x-axis limits and ticks · Issue #2921 · matplotlib/matplotlib
X Title: Boxplot resets x-axis limits and ticks · Issue #2921 · matplotlib/matplotlib
Description: Boxplot appears to reset the x-axis limits and ticks. For example, the following code import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = plt.subplot() ax.set_xlim(0, 4) ax.set_xticks([0, 0.5, 1, 2, 3.5, 4]) ax.set...
Open Graph Description: Boxplot appears to reset the x-axis limits and ticks. For example, the following code import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = plt.subplot() ax.set_xlim(0, 4) ax.s...
X Description: Boxplot appears to reset the x-axis limits and ticks. For example, the following code import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = plt.subplot() ax.set_xlim(0, 4) ax.s...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/2921
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Boxplot resets x-axis limits and ticks","articleBody":"Boxplot appears to reset the x-axis limits and ticks. For example, the following code\n\n```\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfig = plt.figure()\nax = plt.subplot()\nax.set_xlim(0, 4)\nax.set_xticks([0, 0.5, 1, 2, 3.5, 4])\nax.set_xticklabels(['a','b','c', '2', '3.5', '4']) \nax.set_ylim(0, 8)\nax.set_yticks([0, 0.5, 1, 2, 3.5, 4, 8])\nplt.savefig('before_boxplot.png')\n```\n\nproduces this plot\n\nBut when I execute this code next\n\n```\ny1 = np.random.normal(10, 3, 20)\ny2 = np.random.normal(3, 1, 20)\nax.boxplot([y1, y2], positions = [1,2])\nplt.savefig('after_boxplot.png')\n```\n\nthe plot changes to\n\nThree things changed:\n1) The x-axis limits used to be 0 to 4. They are now roughly 0.5 to 2.5.\n2) The tick marks used to be at [0, 0.5, 1, 2, 3.5, 4]. They are now at [1, 2].\n3) The tick mark labels used to be ['a','b','c', '2', '3.5', '4']. They are now ['a', 'b']. Based on the changes in (1) and (2) I would have expected the tick mark labels to be ['c', '2'].\n\nThe obvious work around is to set these parameters after you have called `axes.boxplot()`. However, reseting the axes is not consistent with `axes.plot()`, `axes.bar()`, `axes.imshow()`, or any other plotting method I have used. Other methods respect the user specified x limits and tick marks. This behavior also is not consistent with the y-axis behavior in boxplot. Boxplot respected the user specified y limits and tick marks. \n\nI am working with Matplotlib 1.3.0.\n","author":{"url":"https://github.com/breedlun","@type":"Person","name":"breedlun"},"datePublished":"2014-03-24T00:48:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2921/matplotlib/issues/2921"}
| 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:58d8bf55-7c62-ef21-5ad0-9cbdf7ec58c3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9602:206F88:C16554:10129CA:6A5408E2 |
| html-safe-nonce | 2044b41cf86a2b967f7c27150147f7e8a734b6946a0f5647f2e9b2d7946c42b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjAyOjIwNkY4ODpDMTY1NTQ6MTAxMjlDQTo2QTU0MDhFMiIsInZpc2l0b3JfaWQiOiI1NzUxNTQ4MDkxNTE0MjQ3MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d9a19549aa1d8387f3edeacd82d9ad99ff7d1db9d95e156714fe51fb09fa9479 |
| hovercard-subject-tag | issue:30003037 |
| 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/2921/issue_layout |
| twitter:image | https://opengraph.githubassets.com/83ee4e54d649b698d4d92047c9d985fc7dd26b78129982c77f729dd89cb039dd/matplotlib/matplotlib/issues/2921 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/83ee4e54d649b698d4d92047c9d985fc7dd26b78129982c77f729dd89cb039dd/matplotlib/matplotlib/issues/2921 |
| og:image:alt | Boxplot appears to reset the x-axis limits and ticks. For example, the following code import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = plt.subplot() ax.set_xlim(0, 4) ax.s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | breedlun |
| 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