文章目录
说明
本文运行环境
- macOS 10.13.6
- python 3.7
- Matplotlib 3.0.2
Matplotlib
安装
conda install -c conda-forge matplotlib
引用
import numpy as np
import matplotlib.pyplot as plt
设置notebook
%matplotlib inline
绘制正弦函数
x = np.linspace(0,10,200)
y = np.sin(x)
plt.plot(x,y)
output:
在正弦函数上再绘制余弦函数
plt.plot(x,np.sin(x))
plt.plot(x,np.cos(x))
output:
设置绘图的样式为虚线
plt.plot(x,y,'--')
output:
设置绘图的样式为圆点
x = np.linspace(0,10,100)
y = np.sin(x)
plt.plot(x,y,'o')
output:
设置绘图的样式为六边形