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 ...
随机推荐
- W-GAN系 (Wasserstein GAN、 Improved WGAN)
学习总结于国立台湾大学 :李宏毅老师 WGAN前作:Towards Principled Methods for Training Generative Adversarial Networks W ...
- Python-百度经纬度转高德经纬度
import math def bdToGaoDe(lon,lat): """ 百度坐标转高德坐标 :param lon: :param lat: :return: &q ...
- 关于nginx报错/usr/share/nginx/html/jiankongshare" failed (2: No such file or directory)的问题解决
nginx的location虚拟目录配置: monitor.conf server { server_name monitor.chinasoft.com; server_ ...
- Java基础94 分页查询(以MySQL数据库为例)
1.概述 分页查询,也可叫做分批查询,基于数据库的分页语句(不同数据库是不同的). 本文使用的事MySql数据库. 假设:每页显示10条数据. Select * from c ...
- SqlServer 2017 下载地址及密钥
下载地址: ed2k://|file|cn_sql_server_2017_developer_x64_dvd_11296175.iso|1769777152|E21AE7C3576C0BDF1BC0 ...
- oracle 各个版本下载地址
Oracle9i Database Release 2 Enterprise/Standard/Personal Edition for Windows NT/2000/XP http://downl ...
- python 全栈开发,Day85(Git补充,随机生成图片验证码)
昨日内容回顾 第一部分:django相关 1.django请求生命周期 1. 当用户在浏览器中输入url时,浏览器会生成请求头和请求体发给服务端 请求头和请求体中会包含浏览器的动作(action),这 ...
- 对象奔驰E2000
<script> window.onload = function (ev) { // 调用对象前先创建 // 2 var vcar=new Car("奔驰",&quo ...
- HDU2873 Bomb Game(二维SG函数)
Bomb Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- LINQ学习之旅 C#3.0新特性(一)
一:C#3.0新语言的特性 自动属性(Auto-Implemented Properties) 隐含类型局部变量(Local Variable Type Inference) 匿名类型(Anonymo ...