import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
matplotlib学习笔记一
plt.plot([1,2,3],[1,2,3])
plt.xlabel('x', fontsize=14)
plt.ylabel('y')
Text(0,0.5,'y')

各种参数
小插一个markdown的表格
左对齐 | 右对齐 | 居中对齐 |
---|
单元格 | 单元格 | 单元格 |
单元格 | 单元格 | 单元格 |
plt.plot([1,2,3],[1,2,3],linestyle='--',color='r',linewidth=3.0,marker='o',markerfacecolor='b',markersize=10,alpha=.5)
plt.xlabel('x', fontsize=14)
plt.ylabel('y')
plt.title('test')
plt.text(2,2.2,'point')
plt.grid(True)
plt.annotate('point',xy=(2,2),xytext=(2.5,1.5),arrowprops=dict(
facecolor='black',shrink=0.05,headwidth=16,headlength=20))
Text(2.5,1.5,'point')

子图
x = np.arange(0,10,0.5)
plt.plot(x, x, 'r--')
plt.plot(x, x**2, 'bs')
plt.plot(x, x**3, 'go')
[<matplotlib.lines.Line2D at 0x214745bbc50>]

plt.plot(x, x, 'r--',
x, x**2, 'bs',
x, x**3, 'go')
[<matplotlib.lines.Line2D at 0x21474614828>,
<matplotlib.lines.Line2D at 0x21474614978>,
<matplotlib.lines.Line2D at 0x21474614eb8>]

plt.subplot(221)
plt.plot(x, x, 'r--')
plt.subplot(222)
plt.plot(x, x**2, 'r--')
[<matplotlib.lines.Line2D at 0x21474affd30>]
