analysis专栏 02.数据可视化模块 03.绘制曲线图
# 03.绘制曲线图[toc]{type: "ol", level: [3,4,5]}### 一元二次方程曲线```pythonimport matplotlib.pyplot as plt# 需要传入n个点 点越多越精确x = range(-100, 100)y = [i**2 for i in x]plt.plot(x, y)```![一元二次方程曲线](imgs/04.png)### 正弦|
·
# 03.绘制曲线图
[toc]{type: "ol", level: [3,4,5]}
### 一元二次方程曲线
```python
import matplotlib.pyplot as plt
# 需要传入n个点 点越多越精确
x = range(-100, 100)
y = [i**2 for i in x]
plt.plot(x, y)
```
![一元二次方程曲线](imgs/04.png)
### 正弦|余弦曲线
```python
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
# 正弦曲线
sin_y = np.sin(x)
plt.plot(x, sin_y)
plt.show()
# 余弦曲线
cos_y = np.cos(x)
plt.plot(x, cos_y)
plt.show()
```
![正弦](imgs/05.png)
![余弦](imgs/06.png)
更多推荐
已为社区贡献16条内容
所有评论(0)