Skip to content

RFC: use MPL cycler colors / "dark mode" [ci skip]#8217

Closed
drammock wants to merge 1 commit intomne-tools:mainfrom
drammock:darkmode
Closed

RFC: use MPL cycler colors / "dark mode" [ci skip]#8217
drammock wants to merge 1 commit intomne-tools:mainfrom
drammock:darkmode

Conversation

@drammock
Copy link
Copy Markdown
Member

@drammock drammock commented Sep 6, 2020

There's been some talk about making a "dark mode" for our 2D plotting. I did a bit of investigating with raw.plot(), here's what I found:

  • because we specify colors in mne/defaults.py (which gets loaded when the package is imported), using plt.style.use('dark_mode') or with plt.style.context('dark_mode'): don't work as expected unless the import mne statement comes after the style invocation.
  • the default cycles don't have enough blue-ish colors to keep things roughly the same as they are now (we currently use 3 different shades of blue for mag, grad, and ref-meg channels).
  • there is actually not very good parallelism between MPL normal mode and dark mode. I had wrongly thought that the "blue-orange-green-red..." sequence in default MPL style was replaced in dark mode by pale versions of each color but with roughly the same hue. This is not the case: below are the actual colors (with names made up by me), showing that, e.g. (for C2), what is green in normal mode is lavender in dark mode. This is... not great.
#    |   normal mode     |      dark mode
# ------------------------------------------------
# C0 |  #1f77b4  blue    |  #8dd3c7  pale blue
# C1 |  #ff7f0e  orange  |  #feffb3  pale yellow
# C2 |  #2ca02c  green   |  #bfbbd9  pale lavender
# C3 |  #d62728  red     |  #fa8174  salmon
# C4 |  #9467bd  purple  |  #81b1d2  blue
# C5 |  #8c564b  brown   |  #fdb462  tangerine
# C6 |  #e377c2  pink    |  #b3de69  spring green
# C7 |  #7f7f7f  grey    |  #bc82bd  lavender
# C8 |  #bcbd22  yellow  |  #ccebc4  pale green
# C9 |  #17becf  teal    |  #ffed6f  yellow

See below for what is the best compromise I was able to come up with so far while using the default cycler colors. Obviously this is an incomplete attempt, just wanted to show the blue-and-teal-on-black look:

darkmode

alternatives

we could roll-our-own dark mode by adding a couple keys to the default color dict (i.e., "foreground" and "background"), and then having a separate pre-defined dict for a dark-mode version of the default colors.

cc @cbrnr, who has expressed interest in this.

@cbrnr
Copy link
Copy Markdown
Contributor

cbrnr commented Sep 7, 2020

I'd be OK with a manually specified set of dark colors. The traces look pretty good in your screenshot - are you planning on making the rest of the window dark as well? Also, EEG is normally black so I guess this will become white?

@drammock
Copy link
Copy Markdown
Member Author

drammock commented Sep 7, 2020

are you planning on making the rest of the window dark as well?

Yes. I have that working locally

Also, EEG is normally black so I guess this will become white?

Yes.

Base automatically changed from master to main January 23, 2021 18:26
@larsoner
Copy link
Copy Markdown
Member

@drammock if you want to come back to this, we converged on a usable set of colors in mne-qt-browser / mne-tools/mne-qt-browser#108 . I've been using them for a while now with no (big) issues locally at least

@drammock
Copy link
Copy Markdown
Member Author

@drammock if you want to come back to this

I see this as very low priority. To me it's only worth it if we make a global setting that applies to all of our 2D plots (similar to seaborn.set_theme) which is a lot of work I think.

@drammock drammock closed this Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants