1 介绍
matplotlib.pyplot.xkcd(scale=1,
length=100,
randomness=2
)
scale | 相对于不使用xkcd的风格图,褶皱的幅度 |
length | 褶皱长度 |
randomness | 褶皱的随机性 |
2 举例
2.0 不使用xkcd
import matplotlib.pyplot as plt
import numpy as np
x=np.random.randint(0,100,1000)
plt.hist(x,range=[0,10])
2.1 默认参数
with plt.xkcd(scale=1, length=100, randomness=2):
plt.hist(x,range=[0,10])
2.2 scale
with plt.xkcd(scale=10, length=100, randomness=2):
plt.hist(x,range=[0,10])
2.3 length
with plt.xkcd(scale=1, length=10, randomness=2):
plt.hist(x,range=[0,10])
2.4 randomness
with plt.xkcd(scale=1, length=100, randomness=200):
plt.hist(x,range=[0,10])