Python3绘图库Matplotlib(01)
1 First plots with Matplotlib
简单的绘图1

简单的绘图2

简单的绘图3

2 网格 = grid

3 设置坐标轴的取值范围 = axis xlim ylim

方法1:整体设置
方法2:分别设置
4 设置坐标含义标签 = label

5 设置图片的整体标题 = title

6 设置图例 = legend

方法2:
图例的位置参数:loc = Code
String | Code |
best | 0 |
upper right | 1 |
upper left | 2 |
lower left | 3 |
lower right | 4 |
right | 5 |
center left | 6 |
center right | 7 |
lower center | 8 |
upper center | 9 |
center | 10 |
7 一副完整的图像

8 保存图片 = savefig
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.savefig("plot123.png")
plt.savefig('plot123_2.png', dpi=200)
#
import matplotlib as mpl
mpl.rcParams['figure.figsize']
mpl.rcParams['savefig.dpi']
mpl.reParams['Agg']
9 本小结所有代码示例
import matplotlib.pyplot as plt
plt.plot([1, 3, 2, 4])
plt.show() import matplotlib.pyplot as plt
x = range(6)
plt.plot(x, [xi**2 for xi in x])
plt.show() import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0.0, 6.0, 0.01)
plt.plot(x, [x**2 for x in x])
plt.show() import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
plt.plot(x, x*1.5, x, x*3.0, x, x/3.0)
plt.grid(True)
plt.show() import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
plt.plot(x, x*1.5, x, x*3.0, x, x/3.0)
plt.axis() # 显示当前坐标轴的极限取值范围 x->(0.85, 4.15), y->(-0.25, 12.58)
plt.axis([0, 5, -1, 13]) # 从新设置当前坐标轴的范围
plt.show() import matplotlib.pyplot as plt
plt.plot([1, 3, 2, 4])
plt.xlabel('This is the X axis') #这个是x轴的标签
plt.ylabel('This is the Y axis') #这个是y轴的标签
plt.show() import matplotlib.pyplot as plt
plt.plot([1, 3, 2, 4])
plt.title('Simple plot') # 图像的标题
plt.show() import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
plt.plot(x, x*1.5, label="Normal")
plt.plot(x, x*3.0, label="Fast")
plt.plot(x, x/3.0, label="Slow")
plt.legend() # 设置图例
plt.show() import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
plt.plot(x, x*1.5, x, x*3.0, x, x/3.0)
plt.grid(True)
plt.title('Sample Growth of a Measure')
plt.xlabel('Samples')
plt.ylabel('Values Measured')
plt.legend(['Normal', 'Fast', 'Slow'], loc = 'upper left')
plt.show() import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.savefig("plot123.png")
import matplotlib as mpl
mpl.rcParams['figure.figsize']
mpl.rcParams['savefig.dpi']
plt.savefig('plot123_2.png', dpi=200)
知识在于点点滴滴的积累,我会在这个路上Go ahead,
后记:打油诗一首
适度锻炼,量化指标
考量天气,设定目标
科学锻炼,成就体标
高效科研,实现学标
Python3绘图库Matplotlib(01)的更多相关文章
- Python3绘图库Matplotlib(02)
控制颜色 Color Color Name b blue c cyan g green k black m magenta r red w white y yellow plt.plot(x1, y1 ...
- Python 绘图库Matplotlib入门教程
0 简单介绍 Matplotlib是一个Python语言的2D绘图库,它支持各种平台,并且功能强大,能够轻易绘制出各种专业的图像. 1 安装 pip install matplotlib 2 入门代码 ...
- python 绘图库 Matplotlib
matplotlib官方文档 使用Matplotlib,能够轻易生成各种图像,例如:直方图.波谱图.条形图.散点图等. 入门代码实例 import matplotlib.pyplot as plt i ...
- 数据可视化:绘图库-Matplotlib
为什么要绘图? 一个图表数据的直观分析,下面先看一组北京和上海上午十一点到十二点的气温变化数据: 数据: 这里我用一段代码生成北京和上海的一个小时内每分钟的温度如下: import random co ...
- windows环境下,用python绘图库matplotlib绘图时中文乱码问题
1.下载中文字体(看自己爱好就行)下面这个举例: SimHei - Free Font Downloadwww.fontpalace.co 2.下载之后,打开即可安装,将字体安装进windows系统 ...
- 【Matplotlib-01】Python 绘图库 Matplotlib 入门教程
环境: Windows10 python3.6.4 numpy1.14.1 matplotlib2.1.2 工具:Cmder 目录: 1.线性图 2.散点图 3.饼状图 4.条形图 5.直方图 例1: ...
- 『科学计算』科学绘图库matplotlib学习之绘制动画
基础 1.matplotlib绘图函数接收两个等长list,第一个作为集合x坐标,第二个作为集合y坐标 2.基本函数: animation.FuncAnimation(fig, update_poin ...
- Ubuntu下安装Python绘图库Matplotlib的方法
在安装好Python的基础上, sudo apt-get install python-numpy sudo apt-get install python-scipy sudo apt-get ins ...
- 『科学计算』科学绘图库matplotlib练习
思想:万物皆对象 作业 第一题: import numpy as np import matplotlib.pyplot as plt x = [1, 2, 3, 1] y = [1, 3, 0, 1 ...
随机推荐
- opencv入门指南(转载)
转载链接:http://blog.csdn.net/morewindows/article/details/8426318 网上的总结的一些用openncv的库来做的事: 下面列出OpenCV入门指南 ...
- linux新内核的freeze框架以及意义【转】
转自:https://blog.csdn.net/dog250/article/details/5303442 linux的电源管理发展非常迅速,比如在挂起到内存的时候,系统会冻结住所有的进程,也就是 ...
- nginx简单介绍
代理服务器:一般是指局域网内部的机器通过代理服务器发送请求到互联网上的服务器,代理服务器一般作用在客户端.应用比如:GoAgent,FQ神器. 一个完整的代理请求过程为: 客户端首先与代理服务器创建连 ...
- LVS负载均衡器DR模型的实现
概述: 在大规模互联网应用中,负载均衡设备是必不可少的一个节点,源于互联网应用的高并发和大流量的冲击压力,我们通常会在服务端部署多个无状态的应用服务器和若干有状态的存储服务器(数据库.缓存等等) 一. ...
- centos常用网络管理命令
网卡配置命令:ifconfig (ip addr , ip link) ifconfig:显示所有活动状态的相关信息 ifconfig Interface:仅显示指定接口的相关信息 ifc ...
- LeetCode(8):字符串转整数(atoi)
Medium! 题目描述: 实现 atoi,将字符串转为整数. 在找到第一个非空字符之前,需要移除掉字符串中的空格字符.如果第一个非空字符是正号或负号,选取该符号,并将其与后面尽可能多的连续的数字组合 ...
- SPLAY,LCT学习笔记(六)
这应该暂时是个终结篇了... 最后在这里讨论LCT的一个常用操作:维护虚子树信息 这也是一个常用操作 下面我们看一下如何来维护 以下内容转自https://blog.csdn.net/neither_ ...
- javafx点击鼠标出现弹窗,demo
在学习javafx的过程中,不知道怎么出现一个弹窗,如,点击一个按钮出现一个修改信息的列表选项 终于在javafx文档示例中发现了类似的东西,记录一下,备忘package demo9_button; ...
- 《剑指offer》-递增数组中找到和为S的(最小)两个元素
题目描述 输入一个递增排序的数组和一个数字S,在数组中查找两个数,是的他们的和正好是S,如果有多对数字的和等于S,输出两个数的乘积最小的. 输出描述: 对应每个测试案例,输出两个数,小的先输出. 首先 ...
- node.js开发博客系统---前端项目搭建(一)
Express: https://github.com/petecoop/generator-express 安装node.js和npm 执行: npm install -g yo npm insta ...