You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
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.
Reacted by Gabriel Aparecido Fonseca, Burker Alexander and Guy Van den Broeck
Activity
rchiodo commentedon 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 commentedon Oct 15, 2019
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 commentedon 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 commentedon Oct 15, 2019
thanks for the advices Rich Chiodo (@rchiodo) and Ian Huff (@IanMatthewHuff), I don't know what I am doing wrong, but this doesn't seem to work for me.
Like Ian Huff (@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 commentedon 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.