Matplotlib数据可视化
绘制折线图 pyplot
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
siny = np.sin(x)
cosy = np.cos(x)
plt.plot(x, siny, label="sin x")
plt.plot(x, cosy, color="red", linestyle="--", label="cos x")
plt.axis([-5, 15, -1.5, 1.5])
plt.xlabel("x_axis")
plt.ylabel("y_axis")
plt.legend()
plt.title("Title!!!!")
plt.show()

绘制散点图
plt.scatter(x, siny, label="sin x")
plt.scatter(x, cosy, color="red", label="cos x")
plt.axis([-5, 15, -1.5, 1.5])
plt.legend()
plt.show()

x = np.random.normal(0, 1, 10000)
y = np.random.normal(0, 1, 10000)
plt.scatter(x, y, alpha=0.1)
plt.show()
