Title: Fixes pyplot xticks() and yticks() by allowing setting only the labels by rscmendes · Pull Request #15788 · matplotlib/matplotlib · GitHub
Open Graph Title: Fixes pyplot xticks() and yticks() by allowing setting only the labels by rscmendes · Pull Request #15788 · matplotlib/matplotlib
X Title: Fixes pyplot xticks() and yticks() by allowing setting only the labels by rscmendes · Pull Request #15788 · matplotlib/matplotlib
Description: PR Summary This PR was suggested in issue #15005 as to fix the error that is returned when xticks() or yticks() is called with only the labels as parameters. The changes remove the error by allowing setting only the labels. This is useful for cases where we plot multiple boxplots or bar plots in the same figure, in where we know exactly how many boxplots or bars to plot. The xticks are always range(n), where n is the number of boxplots or bars to put in the plot. Simple test example: import matplotlib.pyplot as plt import numpy as np data = [np.random.rand(5), np.random.rand(5)] plt.boxplot(data) plt.xticks(labels=['first', 'second']) # fails on current pyplot with TypeError: object of type 'NoneType' has no len(). Fixed in this PR plt.show() plt.figure() plt.boxplot(data, vert=False) plt.yticks(labels=['first', 'second']) # fails on current pyplot with TypeError: object of type 'NoneType' has no len(). Fixed in this PR plt.show() Note: I didn't add any example to the examples in the function description. Do you think it would be valuable? PR Checklist Has Pytest style unit tests Code is Flake 8 compliant New features are documented, with examples if plot related Documentation is sphinx and numpydoc compliant Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there) Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way
Open Graph Description: PR Summary This PR was suggested in issue #15005 as to fix the error that is returned when xticks() or yticks() is called with only the labels as parameters. The changes remove the error by allowin...
X Description: PR Summary This PR was suggested in issue #15005 as to fix the error that is returned when xticks() or yticks() is called with only the labels as parameters. The changes remove the error by allowin...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/15788
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:062622bd-3c4d-9880-b8a7-38dfd67978ad |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C1DE:29F49A:1199095:17A2B81:6A56C0D5 |
| html-safe-nonce | 39865357fdf712b896429820a0130962970272e0909ae0529299344a12b8ba3b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMURFOjI5RjQ5QToxMTk5MDk1OjE3QTJCODE6NkE1NkMwRDUiLCJ2aXNpdG9yX2lkIjoiNTkyNTE1ODQ2NjEwOTIyNzIyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | af13c9a8e69df5944abb127dd5c0ce1ed4f2f7fb1607cca96603dee58f902fd6 |
| hovercard-subject-tag | pull_request:346731216 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/15788/files |
| twitter:image | https://avatars.githubusercontent.com/u/3160657?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3160657?s=400&v=4 |
| og:image:alt | PR Summary This PR was suggested in issue #15005 as to fix the error that is returned when xticks() or yticks() is called with only the labels as parameters. The changes remove the error by allowin... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | df99b7164e1d961b639cf5d3cbd6b5ba673edc67bd7e47cdc4746b96099e11ae |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 829f7fb08f3c7a059361601ffe917f622508969c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width