使用 matplotlib 绘制折线图、柱形图、条形图、饼图、散点图的代码如下:
折线图:
```python
import matplotlib.pyplot as plt
# 数据
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
# 绘制折线图
plt.plot(x, y)
# 显示图形
plt.show()
```
柱形图:
```python
import matplotlib.pyplot as plt
# 数据
x = ['A', 'B', 'C', 'D', 'E']
y = [10, 20, 30, 40, 50]
# 绘制柱形图
plt.bar(x, y)
# 显示图形
plt.show()
```
条形图:
```python
import matplotlib.pyplot as plt
# 数据
x = ['A', 'B', 'C', 'D', 'E']
y = [10, 20, 30, 40, 50]
# 绘制条形图
plt.barh(x, y)
# 显示图形
plt.show()
```
饼图:
```python
import matplotlib.pyplot as plt
# 数据
labels = ['A', 'B', 'C', 'D', 'E']
sizes = [10, 20, 30, 40, 50]
# 绘制饼图
plt.pie(sizes, labels=labels)
# 显示图形
plt.show()
```
散点图:
```python
import matplotlib.pyplot as plt
# 数据
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
# 绘制散点图
plt.scatter(x, y)
# 显示图形
plt.show()
```