Reputation: 23
When I make a simple xkcd plot like this:
import matplotlib.pyplot as plt
plt.xkcd()
plt.plot(range(10), range(10))
plt.title('Title')
plt.annotate('annotation', xy = (3,3))
I get a plot with the xkcd fonts, but the plot line and figure lines are straight, not squiggly, as they should be for xkcd.
The parameters of xkcd(length, randomoness, scale) don't have any effect.
I'm using ubuntu 19.10, python 3.7.5rc1, matplotlib 3.1.1, matplotlib backend: GTK3Cairo
I think it might be related to the backend I am using, but when I try to use Qt5Agg or Qt4Agg, I get errors that I have not been able to resolve.
Thanks in advance for your help.
Upvotes: 2
Views: 123
Reputation: 1391
I have the exact same setup as you except that I'm using TkAgg (which is the default backend for me). The plot and figure lines are all squiggly. Maybe try using TkAgg. Oh and by the way I had to change "annotation" to "annotate" to make it run.
Edit: I just checked it with GTK3Cairo backend and now the lines are straight. So it does depend on the backend used.
So try running this:
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('TkAgg')
plt.xkcd()
plt.plot(range(10), range(10))
plt.title('Title')
plt.annotate('annotation', xy = (3,3))
plt.show()
Upvotes: 1