Reputation: 197
I'm using PyCharm with Darcula theme and Jupyter notebook from anaconda package. I faced a problem that Darcula theme is inconvinient to use with Jupyter notebook
For example, pandas plot's axis is not readable.
I tried to find out, how to change notebook cell background, but looks like that there is no possibility to do that.
Of course, I can change PyCharm theme to another, but I used to work under this theme. And of course, I can change background of plot in code, but it is inconvinient to change background for each plots (for example, if I work with ready notebook)
Can I change cells background or the only way is to change theme to another?
Upvotes: 4
Views: 3824
Reputation: 71
Probably a bit too late, but here is a solution for future reference:
1 - Go to PyCharm > Preferences and type in the search bar "Invert image outputs for dark themes"
2 - Go to Language & Frameworks > Jupyter and uncheck the "Invert image outputs for dark themes" box.
3 - Restart PyCharm for option to take effect.
Upvotes: 6
Reputation: 338
Per https://stackoverflow.com/a/40371037/2529760, you can use
fig = plt.figure()
fig.patch.set_facecolor('white')
or
plt.gca().patch.set_facecolor('white')
to force a white background beneath the axis labels on a per-plot basis. You can use
plt.rcParams['figure.facecolor'] = 'white'
to achieve this on a per-notebook basis.
To change this setting globally, normally you can edit the matplotlibrc file, but it appears Jupyter overrides this to some degree. Following https://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/plotting/matplotlib-inline-defaults.ipynb, you can create a file ipython_kernel_config.py
at the correct location (~/.ipython/profile_default
by default) containing the line
c.InlineBackend.rc = {'figure.facecolor': 'white'}
Any of these options will ensure the plot has a white background so the text is legible.
Upvotes: 2
Reputation: 81
You can try the seaborn package:
import seaborn as sns
sns.set_context('notebook')
sns.set_style('white')
It will change the output plot background to white.
Upvotes: 1
Reputation: 1
The temporary workaround for me is to explicitly call plt.show()
at the end of cell.
I am also looking for a better solution.
Upvotes: 0