python数据可视化

matplotlib库

1、 matplotlib是python上的一个2D绘图库;
2、 matplotlib.pyplot提供一个类似matlab的绘图框架,可以绘制直方图,功率谱,条形图,错误图,散点图等。

先看一些pyplot库的基本操作:

#创建新窗口对象
fig = plt.figure(num=‘窗口名’, figsize=(m,n))
num:用来给窗口命名,可选
figsize:用来设置窗口大小,可选
更多参数参见help(plt.figur)

#绘制多子图图形·
fig1 = fig.add_subplot(231)
这里的‘233’代表将fig窗口对象划分为“2*3”个子图,fig1为第一个子图

#设置标题
plt.title(‘Scatter Plot’)
#设置X轴标签
plt.xlabel(‘X’)
#设置Y轴标签
plt.ylabel(‘Y’)
#显示所画的图
plt.show()

散点图

原型:
matplotlib.pyplot.scatter(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None,*, plotnonfinite=False, data=None, **kwargs)

参数:

x,y:array_like, shape (n, )
s:scalar or array_like, shape (n, ), optional
c:color, sequence, or sequence of color, optional

    The marker color. Possible values:    
    - A single color format string.
    - A sequence of color specifications of length n.
    - A sequence of n numbers to be mapped to colors using *cmap* and
      *norm*.
    - A 2-D array in which the rows are RGB or RGBA. 

marker:MarkerStyle,optional
alpha:scalar, optional, default: None
The alpha blending value, between 0 (transparent) and 1 (opaque).

scatter参数先介绍这些,后面有用到其他的再更新……

未完待续…

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值