import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2 * np.pi, 10)
y1, y2 = np.sin(x), np.cos(x)
line1, =plt.plot(x, y1, marker='o', mec='r', mfc='w')
line2, =plt.plot(x, y2, marker='*', ms=10)
plt.legend([line1, line2], ["line 2", "line 1"],loc='best',frameon=False)
plt.xlabel('this is x-axis'); plt.ylabel('thi is y-axis');
plt.show()
效果如图