matplotlib,为每一行添加图例?

时间:2018-02-12 23:15:23

标签: python-3.x matplotlib

我的代码如下:

import matplotlib.pyplot as plt

x1 = [1, 2, 3]
y1 = [1, 2, 3]
x2 = [1, 2, 3]
y2 = [53, 2, 3]

fig = plt.figure()
ax = fig.add_subplot(111)

ax.semilogx(x1, y1, marker='o', label='Phase Envelope')
ax.semilogx(x2, y2, marker=',', label='Isotherm, 200 C')

plt.show()

我想为每一行添加图例,但由于某种原因,label ='...'参数不起作用。我以为这是添加传奇的代码。我该怎么办?

0 个答案:

没有答案