Title: Using to_rgba rather than to_rgb in figure_edit by dwgoon · Pull Request #6589 · matplotlib/matplotlib · GitHub
Open Graph Title: Using to_rgba rather than to_rgb in figure_edit by dwgoon · Pull Request #6589 · matplotlib/matplotlib
X Title: Using to_rgba rather than to_rgb in figure_edit by dwgoon · Pull Request #6589 · matplotlib/matplotlib
Description: OS: Windows 7 (64bit) Python: Anaconda, Python 3.4.4 (64bit) matplotlib: 1.5.1 (version used for this test) matplotlib backend: Qt4Agg or Qt5Agg If I set "markerfacecolor" as "none" (not None) for plotting, I get the following exception when I push the editing button of toolbar. Traceback (most recent call last): File "C:\Users\dwlee\Anaconda\envs\py34\lib\site-packages\matplotlib\colors.py", line 309, in to_rgb fl = float(argl) ValueError: could not convert string to float: 'none' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\dwlee\Anaconda\envs\py34\lib\site-packages\matplotlib\backends\backend_qt5.py", line 645, in edit_parameters figureoptions.figure_edit(axes, self) File "C:\Users\dwlee\Anaconda\envs\py34\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 89, in figure_edit fc = rgb2hex(colorConverter.to_rgb(line.get_markerfacecolor())) File "C:\Users\dwlee\Anaconda\envs\py34\lib\site-packages\matplotlib\colors.py", line 331, in to_rgb 'to_rgb: Invalid rgb arg "%s"\n%s' % (str(arg), exc)) ValueError: to_rgb: Invalid rgb arg "none" could not convert string to float: 'none' Here is the example code for testing. import numpy as np import matplotlib.pyplot as plt X = np.random.rand(100, 1000) xs = np.mean(X, axis=1) ys = np.std(X, axis=1) fig = plt.figure() ax = fig.add_subplot(111) line, = ax.plot(xs, ys, 'o', markerfacecolor="none") plt.show() One solution is to use "to_rgba" of colorConverter in "matplotlib\backends\qt_editor\figureoptions.py" rather than "to_rgb". It is because "to_rgb" does not handle the "none" option as a transparent color, whereas "to_rgba" does. # Before color = rgb2hex(colorConverter.to_rgb(line.get_color())) ec = rgb2hex(colorConverter.to_rgb(line.get_markeredgecolor())) fc = rgb2hex(colorConverter.to_rgb(line.get_markerfacecolor())) # Fixed color = rgb2hex(colorConverter.to_rgba(line.get_color())) ec = rgb2hex(colorConverter.to_rgba(line.get_markeredgecolor())) fc = rgb2hex(colorConverter.to_rgba(line.get_markerfacecolor()))
Open Graph Description: OS: Windows 7 (64bit) Python: Anaconda, Python 3.4.4 (64bit) matplotlib: 1.5.1 (version used for this test) matplotlib backend: Qt4Agg or Qt5Agg If I set "markerfacecolor" as "none&...
X Description: OS: Windows 7 (64bit) Python: Anaconda, Python 3.4.4 (64bit) matplotlib: 1.5.1 (version used for this test) matplotlib backend: Qt4Agg or Qt5Agg If I set "markerfacecolor" as &am...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/6589
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ab15632b-bc08-e33e-bb7c-84ac84e2dde9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D744:25764D:126C4:16CC1:6A52DE5D |
| html-safe-nonce | 65dbaacf25d336ec4d7252c846bb91ae3e7a1ea83db687a48edc0f8d8ebf567a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzQ0OjI1NzY0RDoxMjZDNDoxNkNDMTo2QTUyREU1RCIsInZpc2l0b3JfaWQiOiIxMjQzNzA1ODg0MTkyNzI2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | afcfb1f6e3641501a66772f567e247112057ea6375c819c8c4de3518a2d2fe1d |
| hovercard-subject-tag | pull_request:73939933 |
| 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/6589/files |
| twitter:image | https://avatars.githubusercontent.com/u/9444960?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/9444960?s=400&v=4 |
| og:image:alt | OS: Windows 7 (64bit) Python: Anaconda, Python 3.4.4 (64bit) matplotlib: 1.5.1 (version used for this test) matplotlib backend: Qt4Agg or Qt5Agg If I set "markerfacecolor" as "none&... |
| 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