Skip to content

Figure background is transparent when saving png from notebook backend. #8654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
efiring opened this issue May 23, 2017 · 6 comments
Closed
Milestone

Comments

@efiring
Copy link
Member

efiring commented May 23, 2017

Bug report

In Jupyter notebook with %matplotlib notebook:
Code for reproduction

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1,2])
fig.savefig('test.png')

I used a screenshot below instead of the file 'test.png' because the odd background only shows up in preview, which evidently uses a light gray background instead of the usual white.
Actual outcome
screenshot_gray_background

Expected outcome
I expect the white figure background that results in the above example when saving a pdf, or when using a different backend.

Matplotlib version

  • Operating System: OS X 10.12.4
  • Matplotlib Version: 2.0.2+7.ge6295a4a7
  • Python Version: 3.5.2
  • Jupyter Version (if applicable): 4.2.1
@tacaswell tacaswell added this to the 2.1 (next point release) milestone May 23, 2017
@WeatherGod
Copy link
Member

WeatherGod commented May 23, 2017 via email

@anntzer
Copy link
Contributor

anntzer commented Aug 31, 2017

Nah, this is controlled by the nbagg.transparent rcparam which has defaulted to true, well, probably ever since nbagg existed (https://github.com/matplotlib/matplotlib/pull/3560/files).

TBH I don't see why this was even introduced (well, perhaps @pelson can comment on that :-)), although this may be related to defaulting to a white background in 2.0. Unless there's a compelling reason to keep it I would suggest deprecating this (figure.facecolor should be more than enough, especially now that you can set it using a RRGGBBAA string).

@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.1 (next point release) Aug 31, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@Atcold
Copy link

Atcold commented Oct 18, 2017

This was hard to debug... There is already a figure.facecolor which should be controlling the figure's colour. What's this additional parameter?
Now behaviour of inline and notebook are not consistent (meaning, I spent an hour trying to figure out why my scripts are not working interchangeably).

@anntzer
Copy link
Contributor

anntzer commented Oct 18, 2017

Feel free to put up a PR deprecating the rcparam (I would support doing so).

@github-actions
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Apr 12, 2023
@QuLogic
Copy link
Member

QuLogic commented Apr 12, 2023

This was deprecated in #10024 and removed in #12763.

@QuLogic QuLogic closed this as completed Apr 12, 2023
@QuLogic QuLogic removed the status: inactive Marked by the “Stale” Github Action label Apr 12, 2023
@QuLogic QuLogic modified the milestones: future releases, v3.1.0 Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants