Title: pyplot.set_cmap broken by f0k · Pull Request #896 · matplotlib/matplotlib · GitHub
Open Graph Title: pyplot.set_cmap broken by f0k · Pull Request #896 · matplotlib/matplotlib
X Title: pyplot.set_cmap broken by f0k · Pull Request #896 · matplotlib/matplotlib
Description: With at least matplotlib 1.1.1rc and above (the one in Ubuntu 12.04 LTS), the following code does not work, while it worked in at least matplotlib 0.99.1.1 and below (the one in Ubuntu 10.04 LTS): import pylab pylab.set_cmap('hot') pylab.imsave('test.png', pylab.array([[0,1],[1,0]])) The following code works in both versions of matplotlib: import pylab pylab.hot() pylab.imsave('test.png', pylab.array([[0,1],[1,0]])) The attached pull request restores the behavior of earlier matplotlib versions, consistent with the docstring of pyplot.set_cmap. Background information: In the current version of matplotlib, pyplot.set_cmap throws a RuntimeError('You must first define an image, eg with imshow') when pyplot.gci() returns None. This is wrong, as the documentation explicitly states that it sets "the default colormap" and only applies it "to current image if any". Of course, set_cmap is not needed in the example above, but it's terribly useful for colormaps that do not have a shortcut method (such as 'binary').
Open Graph Description: With at least matplotlib 1.1.1rc and above (the one in Ubuntu 12.04 LTS), the following code does not work, while it worked in at least matplotlib 0.99.1.1 and below (the one in Ubuntu 10.04 LTS): ...
X Description: With at least matplotlib 1.1.1rc and above (the one in Ubuntu 12.04 LTS), the following code does not work, while it worked in at least matplotlib 0.99.1.1 and below (the one in Ubuntu 10.04 LTS): ...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/896
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3fd0da32-4e2a-d264-ee51-01a8254a3542 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | EA10:262FA5:AD7BB3:EC096D:6A531911 |
| html-safe-nonce | f5bd2e1f280b54b06922f680e82f8d894e715774d976cea07532f05100ed380f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTEwOjI2MkZBNTpBRDdCQjM6RUMwOTZEOjZBNTMxOTExIiwidmlzaXRvcl9pZCI6IjI1MDU3MTc1OTA1MTg4NjQxNDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3c9090fed6ab718e1b91008fef995a08dd1f25656ab2cf7dc9ea55503ff08c1a |
| hovercard-subject-tag | pull_request:1416185 |
| 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/896/files |
| twitter:image | https://avatars.githubusercontent.com/u/629706?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/629706?s=400&v=4 |
| og:image:alt | With at least matplotlib 1.1.1rc and above (the one in Ubuntu 12.04 LTS), the following code does not work, while it worked in at least matplotlib 0.99.1.1 and below (the one in Ubuntu 10.04 LTS): ... |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width