【发布时间】:2014-09-16 12:50:26
【问题描述】:
如何使用 matplotlib 制作类似的估计线。
我有几个点,我使用 matplotlib 使用以下代码绘制它们:
import matplotlib.pyplot as plt
for smp, lbl in zip(samples, labels):
plt.scatter(smp[0], smp[1], marker='*', cl = 'b', s=100, label=lbl)
# set limit, xlabel, ylabel, legend ...
# ...
plt.show()
谢谢,
【问题讨论】:
-
你不应该用它自己的 scatter 命令绘制每一个点。这需要很长时间,如果您想拥有一个图例,您将拥有每个点的条目。你可以使用这个:
x = [value[0] for value in samples]y = [value[1] for value in samples]
标签: python graph matplotlib