Title: Defined the test_clabel function in the test_datetime file by Ali-Aboelela · Pull Request #27490 · matplotlib/matplotlib · GitHub
Open Graph Title: Defined the test_clabel function in the test_datetime file by Ali-Aboelela · Pull Request #27490 · matplotlib/matplotlib
X Title: Defined the test_clabel function in the test_datetime file by Ali-Aboelela · Pull Request #27490 · matplotlib/matplotlib
Description: PR summary This PR is one of the issues identified by the larger issue #26864. These changes add a test for the clabel function. I have tested passing datetimes as input labels to the contours and the axis. I could not think of a way nor do I think it to make sense to pass datetime objects as labels to either axis. Edit: Attempt 3 This time I correctly generate the contour using datetime objects and directly pass it to the clabel function. Passing a contour that was generated where either X or Y values contain datetime objects functions correctly. I simply avoided doing any math related to the inputs to find Z. The Hovomoller diagram @rcomer mentioned helped me visualize how this kind of contour plot with dates would be used which helped me form an example. Note: I have NOT been able to specify the locations of the labels using the manual kwarg using datetime objects, please see discussion/comments below Note: I did not use the example where x-axis was used as a date (commented in the code) because it was quite messy, instead I've provided the plot generated when datetime objects are used to set the y-axis of a contour plot. Edit: Attempt 2 Passing datetime objects to the clabel function works as expected and labels the contours as seen in both the above and below imgs Trying to generate contours using datetime objects and thus have the axis be labeled naturally as you would with numbers fails (any kind of math you do with numpy will fail). You can, however use ax.set_ticks and the ax.set_xticklabels functions, passing datetime objects directly if you wish, to label the x-axis of a contour plot. I do not know however, if this is what the original issue was attempting to test. In any case, the following is the plot produced: Original PR summary (Attempt 1) Here is the image generated by this code: PR checklist [N/A] "closes #0000" is in the body of the PR description to link the related issue new and changed code is tested I have struggled to run pytest due to a circular import issue. Instead, the image of the plot was generated using a separate script. [N/A] Plotting related features are demonstrated in an example [N/A] New Features and API Changes are noted with a directive and release note [N/A] Documentation complies with general and docstring guidelines
Open Graph Description: PR summary This PR is one of the issues identified by the larger issue #26864. These changes add a test for the clabel function. I have tested passing datetimes as input labels to the contours and...
X Description: PR summary This PR is one of the issues identified by the larger issue #26864. These changes add a test for the clabel function. I have tested passing datetimes as input labels to the contours and...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/27490
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:25c053d0-8f2c-798e-0f36-961e3b45142b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B772:20B327:261E8E0:32D7568:6A520EA8 |
| html-safe-nonce | 838d9391d00680dbeaa2114401773dda4398b6e2a3aa31b38ff3cc10339485f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzcyOjIwQjMyNzoyNjFFOEUwOjMyRDc1Njg6NkE1MjBFQTgiLCJ2aXNpdG9yX2lkIjoiODY1Mzc1MjE4MTM5NTE2NDg0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d8521c5bddb29b2539d20f83d9860456ffa72716052a92169f9a504aa4b54397 |
| hovercard-subject-tag | pull_request:1637521128 |
| 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/27490/files |
| twitter:image | https://avatars.githubusercontent.com/u/62535124?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/62535124?s=400&v=4 |
| og:image:alt | PR summary This PR is one of the issues identified by the larger issue #26864. These changes add a test for the clabel function. I have tested passing datetimes as input labels to the contours and... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 |
| disable-turbo | true |
| 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