Skip to content

White background on graphs  #2904

Closed
Closed

Description

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

Activity

  1. rchiodo commented on Oct 15, 2019

    @rchiodo
    Contributor

    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.

  2. IanMatthewHuff commented on Oct 15, 2019

    @IanMatthewHuff
    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.

  3. rchiodo commented on Oct 15, 2019

    @rchiodo
    Contributor

    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.

  4. gabriel19913 commented on Oct 15, 2019

    @gabriel19913
    Author

    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.

  5. greazer commented on Oct 18, 2019

    @greazer
    Contributor

    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.

  6. locked as resolved and limited conversation to collaborators on Nov 6, 2019
  7. unlocked this conversation on Nov 14, 2020
  8. locked as resolved and limited conversation to collaborators on May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions