matplotlib.pyplot数据可视化(第三方库)(python)

一、matplotlib.pyplot绘图相关对象
1、容器类:图(figure)、坐标系(axes)、坐标轴(axis)、刻度(tick)
2、基础类:线(line)、点(marker)、文本(text)、图例(legend)、网格(grid)、标题(title)

二、绘图的类型
1、线形图:plot()
2、直方图:hist()
3、条形图:bar()
4、饼图:pie()
5、散点图:scatter()
6、3D图:from mpl_toolkits.mplt3d import Axes3d
7、动态交互图:pyecharts

一、首先要检测环境

源码:

pip show matplotlib

输出:

Name: matplotlib
Version: 3.5.2
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: PSF
Location: c:\users\administrator\anaconda3\lib\site-packages
Requires: cycler, fonttools, kiwisolver, numpy, packaging, pillow, pyparsing, python-dateutil
Required-by: seaborn
Note: you may need to restart the kernel to use updated packages.

二、导入第三方库

 
  1. import matplotlib.pyplot as plt #导入第三方数据可视化库matplotlib中的pyplot绘图模块

  2. import numpy as np #导入科学计算库,别名为np

 

三、不同绘图类型

1、线型图(plot)

源码:

绘制平行四边形

源码:

输出:

同一绘图区域绘制多图

源码:

多区域绘图

源码:

综合示例

源码:

直方图(hist)

源码:

条形图 (bar)

源码:

输出:

饼图(pie) 

源码:

 输出:

散点图(scatter)

 源码:

输出:

3D图 

源码 :

输出:

  • 10
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值