I am trying to make a plot using matplotlib
's xkcd
package while having a black background. However, xkcd seems to add a sort of white contour line around text and lines. On a white background you can't see this white frame, but on a black background it is really annoying.
Does anyone have an idea how to fix this? Maybe an option how to change the white contour lines to have the background color instead?
minimal example:
import numpy as np
import matplotlib.pyplot as pltplt.style.use(['dark_background'])
plt.xkcd()
plt.rcParams['figure.facecolor'] = 'black'x = np.linspace(-5, 5)plt.figure()
plt.plot(x, x**2)
plt.text(0, 10, "Text", color='r', fontsize=20)
plt.xlabel("$x$" )
plt.ylabel("$f(x)$")
plt.show();
:
Edit:
I am using Python 3.5.4
in my jupyter notebook with packages:
matplotlib==2.2.2
, backend='TkAgg'jupyter==1.0.0
notebook==5.5.0
Note, when running the above code as a script I somehow don't get a xkcd plot at all. Only from jupyter notebook or command line I get the described behaviour.