Day4 Scale 和imshow()

这篇博客介绍了在24-Jul-2019的一天中,如何使用numpy生成固定种子的随机数,并探讨了imshow()函数的interpolation参数,包括其支持的不同插值方法,如'nearest', 'bilinear'等。内容来源于goldxwang的博客。" 117347682,10541889,Android USB转串口驱动开发实战:PL2303串口驱动,"['Android开发', 'USB开发', '串口通信', '硬件接口']
摘要由CSDN通过智能技术生成

24-Jul-2019

case1
np.random.seed(1000)
生成随机数,括号里面写了内容每次生成的随机数相同


from matplotlib.ticker import NullFormatter  # useful for `logit` scale

# Fixing random state for reproducibility
np.random.seed(19680801) #利用随机数种子,使得每次生成的随机数相同

# make up some data in the interval【0, 1】
y = np.random.normal(loc=0.5, scale=0.4, size=20)#正态分布,loc是均值,scale是标准差,返回1000个数
y = y[(y > 0) & (y < 1)] #保留下了0至1之间的数,还能这样筛选也是醉了
print(y)
y.sort() #按照从小到大排序
print(y)
x = np.arange(len(y))
print(x) #打印看看生成了写啥

 # plot with various axes scales
plt.figure()
 # linear
plt.subplot(221) #两排两列的第一个图,左上角
plt.plot(x, y)
plt.yscale('linear')
plt.title('linear')
plt.grid(True) #有网格线

# log
plt.subplot(222)
plt.plot(x, y)
plt.yscale('log')
plt.title('log')
plt.grid(True)

# symmetric log
plt.subplot(223)
plt.plot(x, y - y.mean())
plt.yscale('symlog'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值