| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
The test image changes are on the main branch rather than this PR; I have included them here rather than create a separate PR. |
Sorry, something went wrong.
|
I've converted this to Draft as there are changes planned in Matplotlib that will make the fix different and better. |
Sorry, something went wrong.
|
This is now ready. After this is merged I would like a new release. |
Sorry, something went wrong.
|
Sorry I missed that ping me if this get delayed. |
Sorry, something went wrong.
|
I've made you maintainer to unblock you a bit. |
Sorry, something went wrong.
since 3.10 we have the official API `matplotlib.get_backend (auto_select=False)`. No problems have been reported and matplotlib-inline is using it https://github .com/ipython/matplotlib-inline/pull/38. Therefore, I remove the provisional status from the auto-select flag. Additionally, I deprecate the API rcParams._get('backend'), which the above is replacing. It seems that `rcParams._get("backend")` is not used anywhere publically, but let's still be defensive and deprecate. https://github.com/search?q=%2F%5C._get%5C%28%5B%22%27%5Dbackend%5B%22%27%5D%5C%29%2F+language%3APython+NOT+is%3Afork+NOT+path%3A**%2Fmatplotlib%2F**+NOT+path%3A**%2Fsite-packages**+NOT+path%3A**%2Fpyplot.py&type=code This is working towards matplotlib#26406. Follow-up to matplotlib#29039.
since 3.10 we have the official API `matplotlib.get_backend (auto_select=False)`. No problems have been reported and matplotlib-inline is using it https://github .com/ipython/matplotlib-inline/pull/38. Therefore, I remove the provisional status from the auto-select flag. Additionally, I deprecate the API rcParams._get('backend'), which the above is replacing. It seems that `rcParams._get("backend")` is not used anywhere publically, but let's still be defensive and deprecate. https://github.com/search?q=%2F%5C._get%5C%28%5B%22%27%5Dbackend%5B%22%27%5D%5C%29%2F+language%3APython+NOT+is%3Afork+NOT+path%3A**%2Fmatplotlib%2F**+NOT+path%3A**%2Fsite-packages**+NOT+path%3A**%2Fpyplot.py&type=code This is working towards matplotlib#26406. Follow-up to matplotlib#29039.
since 3.10 we have the official API `matplotlib.get_backend (auto_select=False)`. No problems have been reported and matplotlib-inline is using it https://github .com/ipython/matplotlib-inline/pull/38. Therefore, I remove the provisional status from the auto-select flag. Additionally, I deprecate the API rcParams._get('backend'), which the above is replacing. It seems that `rcParams._get("backend")` is not used anywhere publically, but let's still be defensive and deprecate. https://github.com/search?q=%2F%5C._get%5C%28%5B%22%27%5Dbackend%5B%22%27%5D%5C%29%2F+language%3APython+NOT+is%3Afork+NOT+path%3A**%2Fmatplotlib%2F**+NOT+path%3A**%2Fsite-packages**+NOT+path%3A**%2Fpyplot.py&type=code This is working towards matplotlib#26406. Follow-up to matplotlib#29039.
| Back | FazBrowse Home | New Git URL |
Fixes #37 and #25.
When importing backend_inline the function _enable_matplotlib_integration() is automatically called and this checks what the current Matplotlib backend is. Previously calling matplotlib.get_backend() if no backend was currently set would as a side-effect force it to be the default backend for that OS rather than leaving it unset. Changing it to matplotlib.rcParams._get("backend") avoids the side-effect thus fixing the problem.
Although rcParams._get is a private function this is in fact the correct function to use as explained in the Matplotlib source code:
https://github.com/matplotlib/matplotlib/blob/eb812a8e479d0bcf43a30232c31afec78963ed53/lib/matplotlib/__init__.py#L698-L713
To reproduce the original problem and confirm this PR fixes it use the following on the main branch and this PR branch:
On main branch this uses the wrong Matplotlib backend and on this PR branch it used the correct inline backend.
I have manually tested other use cases of using Matplotlib in ipython and jupyter and it looks like this fix does not introduce any new problems.