Python3绘图库Matplotlib(02)
控制颜色

Color | Color Name |
b | blue |
c | cyan |
g | green |
k | black |
m | magenta |
r | red |
w | white |
y | yellow |
控制线的风格

Style | Style |
- | solid line |
-- | dashed line |
-. | dash-dot line |
: | dotted line |
控制标记样式

. | Point marker |
, | Pixel marker |
o | Circle marker |
v | Triangle down |
^ | Triangle up marker |
< | Triangle left marker |
> | Triangle right marker |
1 | Tripod down marker |
2 | Tripod up marker |
3 | Tripod left marker |
4 | Tripod right marker |
s | Square marker |
p | Pentagon marker |
* | Star marker |
h | Hexagon marker |
H | Rotated hexagon marker |
+ | Plus marker |
x | Cross marker |
D | Diamond marker |
d | Thin diamond marker |
| | Vertical line |
_ | Horizontal line |

用关键字参数进行更好的控制

处理X和Y的ticks标签值

画图的类型

直方图图表 = Histogram charts

Error bar charts


Bar Charts


本小结代码示例
- import matplotlib.pyplot as plt
- import numpy as np
- y = np.arange(1, 3)
- plt.plot(y, 'y')
- plt.plot(y+1, 'm')
- plt.plot(y+2, 'c')
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- y = np.arange(1, 3)
- plt.plot(y, '--', y+1, '-.', y+2, ':')
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- y = np.arange(1, 3, 0.2)
- plt.plot(y, 'x', y+0.5, 'o', y+1, 'D', y+1.5, '^', y+2, 's')
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- y = np.arange(1, 3, 0.3)
- plt.plot(y, 'cx--', y+1, 'mo:', y+2, 'kp-.')
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- y = np.arange(1, 3, 0.3)
- plt.plot(y, color='blue', linestyle='dashdot', linewidth=4,
- marker='o', markerfacecolor='red', markeredgecolor='black',
- markeredgewidth=3, markersize=12)
- plt.show()
- import matplotlib.pyplot as plt
- x = [5, 3, 7, 2, 4, 1]
- plt.plot(x)
- plt.xticks(range(len(x)), ['a', 'b', 'c', 'd', 'e', 'f'])
- plt.yticks(range(1, 8, 2))
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- y = np.random.randn(1000)
- plt.hist(y)
- plt.show()
- plt.hist(y, 25)
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- x = np.arange(0, 4, 0.2)
- y = np.exp(-x)
- e1 = 0.1 * np.abs(np.random.randn(len(y)))
- plt.errorbar(x, y, yerr=e1, fmt='.-')
- plt.show()
- e2 = 0.1 * np.abs(np.random.randn(len(y)))
- plt.errorbar(x, y, yerr=e1, xerr=e2, fmt='.-', capsize=0)
- plt.show()
- plt.errorbar(x, y, yerr=[e1, e2], fmt='.-')
- plt.show()
- import matplotlib.pyplot as plt
- plt.bar([1, 2, 3], [3, 2, 5])
- plt.show()
- import matplotlib.pyplot as plt
- import numpy as np
- data1 = 10*np.random.rand(5)
- data2 = 10*np.random.rand(5)
- data3 = 10*np.random.rand(5)
- e2 = 0.5*np.abs(np.random.randn(len(data2)))
- locs = np.arange(1, len(data1)+1)
- width = 0.27
- plt.bar(locs+width, data2, yerr=e2, width=width, color='red')
- plt.bar(locs+2*width, data3, width=width, color='green')
- plt.show()
知识在于点点滴滴的积累,我会在这个路上Go ahead,
后记:打油诗一首
适度锻炼,量化指标
考量天气,设定目标
科学锻炼,成就体标
高效科研,实现学标
Python3绘图库Matplotlib(02)的更多相关文章
- Python3绘图库Matplotlib(01)
1 First plots with Matplotlib 简单的绘图1 简单的绘图2 简单的绘图3 2 网格 = grid 3 设置坐标轴的取值范围 = axis xlim ylim 方法1:整体设 ...
- 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 ...
随机推荐
- 七、Sparse Autoencoder介绍
目前为止,我们已经讨论了神经网络在有监督学习中的应用.在有监督学习中,训练样本是有类别标签的.现在假设我们只有一个没有带类别标签的训练样本集合 ,其中 .自编码神经网络是一种无监督学习算法,它使用 ...
- __ATTR引发的编译错误【原创】
有一天我编译内核模块驱动的时候发现如下错误 Linux kernel版本:4.1.15 error: negative width in bit-field '<anonymous>' 代 ...
- Linux: 介绍make menuconfig中的每个选项含义【转】
转自:http://blog.csdn.net/gaoyuanlinkconcept/article/details/8810468 介绍make menuconfig中的每个选项含义 Linux 2 ...
- 通过全备+主从同步恢复被drop的库或表
MySQL 中drop 等高危误操作后恢复方法 实验目的: 本次实验以恢复drop操作为例,使用不同方法进行误操作的数据恢复. 方法: 利用master同步(本文)] 伪master+Binlog+同 ...
- jython获取was5.1的jvm监控参数
perfName = AdminControl.completeObjectName ('type=Perf,process=server1,node=TSC,cell=TSC,*') perfONa ...
- linux系统下安装tomcat及配置
一.下载TOMCAT压缩包 apache-tomcat-6.0.44-client.zip 或 apache-tomcat-7.0.69.tar.gz 点击进入官网:http://tomcat.apa ...
- Project Euler Problem7
10001st prime Problem 7 By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see t ...
- GitHub学习一-本地电脑与GitHub绑定
1.创建ssh key $ ssh-keygen -t rsa -C "your_email@youremail.com"安装完git,右键git bash here,创建ssh ...
- 下载文件的一致性验证之MD5值校验
前几天写脚本遇到下载功能校验,一时间不到怎么校验好? 于是请教大神,大神给出方案如下: 先去了解一下你们的产品针对这个下载功能有没有做什么功能设计...然后再针对这些功能设计去设计测试用例...比如 ...
- python接口自动化测试五:乱码、警告、错误处理
乱码: 以content字节流输出,解码成utf-8: print(r.encoding) # 查看返回的编码格式: 去掉Warning警告: import urllib3 urllib3.dis ...