dunovank / jupyter-themes

Custom Jupyter Notebook Themes
MIT License
9.74k stars 1.06k forks source link

Setting jtplot.style() in IPython startup not working properly #462

Closed MikolajKolman closed 1 year ago

MikolajKolman commented 1 year ago

Hi, I wanted to set up jupyter-themes in the IPython startup file, but for whatever reason it does not work as expected. The result I am getting is this

Screenshot 2022-08-10 at 16 56 14

and what I want is this Screenshot 2022-08-10 at 16 58 45.

This is not my default display, so the plot is a bit too big, but you get the idea.

This is my IPython startup file, which I have used on two previous machines and setups. The x variable has the value assigned to it, so I know the jtplot function does not produce an exception.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from jupyterthemes import jtplot

jtplot.style(theme='chesterish', figsize=(21, 14), grid=False)
x = 20

In the first picture you can see that the color is right, but the size is the default one and also the borders are a bit weird. After running the same code in the notebook the output is as the one expected (second picture). Any idea what might be causing this behaviour? This is not my first time setting up jupyter-themes with conda, but this time I am truly lost.

Versions:

MikolajKolman commented 1 year ago

I have fixed this. Apparently there has to be the %matplotlib inline command in the first line of the startup file, or at least before matplotlib import. Otherwise the command gets called again in some later place, which overwrites matplotlib configuration.

god i hate this