numpy,matpotlib_绘制折线图散点图

numpy,matpotlib_绘制折线图/散点图

import matplotlib.pylab as pyl
import numpy as npy
#x=[1,2,3,4,8]
#y=[5,7,2,1,5]
#pyl.plot(x,y,'o')#plot(x轴数据,y轴数据,展现形式)散点图
#pyl.show()折线图
#pyl.show()
'''
c-cyan-青色
r-red
m-magente-品红
g-green
b-blue
y-yellow
k-black
w-white

'''
#pyl.plot(x,y,":")#线条形式:"--" -.  : -
#pyl.show()
#点的样式
"""
h--六角形
s--方形
H--六角形
*--星型
+--加号
x--x型
d-菱形
D--菱形
p--五角型
"""
#pyl.plot(x,y,"h")
#pyl.show()
#pyl.plot(x,y)
#x2=[1,3,6,8,10,12,19]
#y2=[1,6,9,10,19,23,35]
#pyl.plot(x2,y2)

#pyl.title("show")
#pyl.xlabel("ages")
#pyl.ylabel("temp")
#pyl.xlim(0,20)
#pyl.ylim(0,40)
#pyl.show()
#怎么生成随机数
import numpy as npy
data=npy.random.random_integers(1,20,10)#生成整数随机数(最小值,最大值,个数)
#print(data)
data2=npy.random.normal(5,2,10)#(均数,西格玛,个数)
#print(data2)
#直方图hist
data3=npy.random.normal(10.0,1.0,10000)
#pyl.hist(data3)
#pyl.show()
data4=npy.random.random_integers(1,25,10000)
#pyl.hist(data4)
sty=npy.arange(1,30,2)
#pyl.hist(data4,sty,histtype='stepfilled')
#pyl.show()
#pyl.subplot(5,3,2)#行,列,区域
#pyl.show()
pyl.subplot(2,2,1)
x1=[1,2,3,4,5]
y1=[5,3,5,23,5]
pyl.plot(x1,y1)
pyl.subplot(2,2,2)
x2=[2,3,5,6,8]
y2=[13,14,5,15,9]
pyl.plot(x2,y2)
pyl.subplot(2,1,2)
x3=[2,5,6,8,9]
y3=[3,5,6,8,7]
pyl.plot(x3,y3)
pyl.show()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值