Giter VIP home page Giter VIP logo

Comments (7)

blink1073 avatar blink1073 commented on August 22, 2024 13

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

from ipympl.

lavajiit avatar lavajiit commented on August 22, 2024 4
  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'}

from ipympl.

lavajiit avatar lavajiit commented on August 22, 2024 2

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

from ipympl.

blink1073 avatar blink1073 commented on August 22, 2024 1

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

image

from ipympl.

Psp29onetwo avatar Psp29onetwo commented on August 22, 2024 1

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.

from ipympl.

blink1073 avatar blink1073 commented on August 22, 2024

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

image

from ipympl.

SylvainCorlay avatar SylvainCorlay commented on August 22, 2024

Closing since the jlab theme cannot set the matplotlib style.

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

from ipympl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.