Skip to content
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

White background on graphs #2904

Closed
gabriel19913 opened this issue Oct 15, 2019 · 5 comments
Closed

White background on graphs #2904

gabriel19913 opened this issue Oct 15, 2019 · 5 comments
Assignees

Comments

@gabriel19913
Copy link

Feature: Notebook Editor, Interactive Window, Python Editor cells

Description

Is there a way to implement white backgound in the plots even when using dark theme like in Jupyter Lab? When I am using a dark theme on vscode I cannot see what is in the graph's axis.

Example:
Jupyter Lab: https://i.ibb.co/bNXZwhy/1-jupyter.png
VsCode: https://i.ibb.co/bHQW506/2-jupyter.png

@rchiodo
Copy link
Contributor

rchiodo commented Oct 15, 2019

Did you change your theme after already running a cell? This should change the theming for the plots automatically. Unless of course you're changing the matplotlib theme yourself.

@IanMatthewHuff
Copy link
Member

Hey gabriel19913. So with matplotlib you can set default styles with the style customization like so.
https://matplotlib.org/3.1.1/api/style_api.html
For our code when we detect dark themes by default we run matplotlib.style.use('dark_background').
However we also provide a setting in VSCode settings Python->Data Science->Run Startup Commands. This allows you to specify a set of custom commands to run at startup. Since these run after our theme settings you could run matplotlib.style.use('your style here') to set it back to light. Then this command would be run whenever you start up the interactive window or notebook editor. Does this work for you? I think 'classic' is just the default light theme.

Past that we also have a Ignore Vscode Theme setting, but that makes the entire window default light themed, so that doesn't sound like the option that you want.

@rchiodo
Copy link
Contributor

rchiodo commented Oct 15, 2019

It should be noted, after changing your theme, you currently need to restart the server (or close the notebook) and rerun the cell to get plots to show up correctly.

Meaning we will render them with a dark background as Ian describes, but only after rerendering. We don't reformat the existing output to be dark.

@gabriel19913
Copy link
Author

thanks for the advices @rchiodo and @IanMatthewHuff, I don't know what I am doing wrong, but this doesn't seem to work for me.
Like @IanMatthewHuff said I tried Python->Data Science->Run Startup Commands so I did this https://i.ibb.co/mhm7GVh/3-jupyter.png.
However now the plots are with a black backgroung:
https://i.ibb.co/x5sNFN2/4-jupyter.png
If I use the command matplotlib.style.use('default') in some cell it works, so I think I will with that for now.
Thanks for helping me.

@greazer
Copy link
Contributor

greazer commented Oct 18, 2019

We need to add a setting to allow the user to decide whether we honor the theme for graphs. By default they should always render to a white background and not apply matplotlib themes.

@IanMatthewHuff IanMatthewHuff self-assigned this Oct 21, 2019
@rchiodo rchiodo self-assigned this Oct 24, 2019
@rchiodo rchiodo closed this as completed Oct 24, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 6, 2019
@microsoft microsoft unlocked this conversation Nov 14, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants