这很简单:
import matplotlib.pyplot as pltplt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here')plt.plot(<X AXIS VALUES HERE>, <Y AXIS VALUES HERE>, 'line type', label='label here')plt.legend(loc='best')plt.show()
您可以随意添加
plt.plot多次。至于
line type,您需要首先指定颜色。所以对于蓝色,它是
b。对于正常的线是
-。一个例子是:
plt.plot(total_lengths, sort_times_heap, 'b-', label="Heap")



