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

How to handle labels when using dark theme with jupyterlabs? #25

Closed
CptanPanic opened this issue Oct 29, 2017 · 7 comments
Closed

How to handle labels when using dark theme with jupyterlabs? #25

CptanPanic opened this issue Oct 29, 2017 · 7 comments

Comments

@CptanPanic
Copy link

Hello I am using JupyterLabs and it works great, but a problem I have is when I generate matplot plots() I can't see the text as I use JupyterLabs in dark theme mode, but it seems that the plots are made with black text and transparent background so I can't see labels, etc. Is there a way to override text color?

@blink1073
Copy link
Member

blink1073 commented Oct 30, 2017

You can use a style sheet, but it looks like styles don't affect plot titles, so those have to be set manually:

%matplotlib ipympl
import matplotlib.pyplot as plt
plt.style.use(['dark_background'])
plt.plot([0,1,12])
plt.suptitle('figure title', color='w')

image

@blink1073
Copy link
Member

blink1073 commented Oct 30, 2017

Actually, we still have a problem with the figure title:

image

@blink1073
Copy link
Member

Yeah the problem isn't the style sheet, it is our rendered title:

image

@lavajiit
Copy link

lavajiit commented Aug 9, 2018

  1. We can use following for changing background:-
    plt.patch.set_facecolor('lightgrey')
    But this will work only for single plot. Not for grid plot, or more than one.

  2. We can use following for getting graphs like we get in jupyter lab light theme:-
    import matplotlib.pyplot as plt
    from matplotlib import style
    style.use('ggplot') or plt.style.use('ggplot')
    We need to specify "style.use('ggplot')" again in any next cell and not in the cell where we first set the style. Yes, we need to set it 2 times. Second should be the lighter theme.
    screenshot from 2018-08-09 22-15-32 01

style.available or plt.style.available
['Solarize_Light2',
'grayscale',
'ggplot',
'seaborn-dark-palette',
'seaborn-poster',
'tableau-colorblind10',
'seaborn-ticks',
'seaborn-muted',
'seaborn-bright',
'_classic_test',
'seaborn-darkgrid',
'seaborn-paper',
'seaborn',
'seaborn-colorblind',
'classic',
'seaborn-talk',
'seaborn-notebook',
'seaborn-dark',
'fivethirtyeight',
'fast',
'bmh',
'seaborn-pastel',
'seaborn-deep',
'seaborn-white',
'seaborn-whitegrid'
'dark_background']

lighter ones are:
{0: 'Solarize_Light2', 1: 'grayscale', 2: 'ggplot', 6: 'seaborn-ticks', 9: '_classic_test', 10: 'seaborn-darkgrid', 12: 'seaborn', 14: 'classic', 17: 'seaborn-dark', 18: 'fivethirtyeight', 23: 'seaborn-white', 24: 'seaborn-whitegrid'}

darker ones are:
{3: 'seaborn-dark-palette', 4: 'seaborn-poster', 5: 'tableau-colorblind10', 7: 'seaborn-muted', 8: 'seaborn-bright', 11: 'seaborn-paper', 13: 'seaborn-colorblind', 15: 'seaborn-talk', 16: 'seaborn-notebook', 19: 'fast', 20: 'bmh', 21: 'seaborn-pastel', 22: 'seaborn-deep', 25: 'dark_background'}

@lavajiit
Copy link

lavajiit commented Jan 23, 2019

Its no more a problem now...perhaps today onwards.
Just update your concerned python libraries(specially jupyterlab):-
pip install --upgrade numpy pandas matplotlib seaborn jupyterlab

git

@SylvainCorlay
Copy link
Member

Closing since the jlab theme cannot set the matplotlib style.

However, in master, the toolbar now uses the JupyterLab CSS variables.

@Psp29onetwo
Copy link

I found one solution for expanding the plot canvas a bit so that x and y ticks will get visible.

You need to add one line plt.style.use('default') after importing the matplot lib module in notebook.

See my ticks are outside the canvas before.

After adding the line the tick got added to the canvas itself no further modification was needed.

As you can see in the above image this will pull the x and y ticks in the canvas to make it visible without changing or modifying ticks or plot color, it will make it easier to collaborate your work with others.

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

No branches or pull requests

5 participants