matplotlib笔记:xkcd 将代码变成手绘风格

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])

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部