2016-11-22 132 views
-2

我想连接绘制的数据点。如何在Python中连接我的散点图的点?

plt.plot(us, mu, 'ro', us, ru, 'go') 
plt.show() 
+0

将您的代码添加到您的问题。 – amin

+2

'ro-','go-'。请参阅http://matplotlib.org/api/pyplot_api.html?highlight=plot#matplotlib.pyplot.plot – Bart

+0

[matplotlib:设置行上各个点的标记]可能的重复(http://stackoverflow.com/questions/8409095/matplotlib-set-markers-for-individual-on-a-line) – Bart

回答

0

按照pyplot documentation你可以试试这个。

# adding dotted line between points 
plt.plot(us, mu, 'r:o', us, ru, 'g:o') 
plt.show() 
+0

不需要调用'plot()'命令两次; Matplotlib在格式上非常灵活,所以用'ro:'和'go:'调用'plot'()会产生相同的结果。 – Bart

+0

感谢您的评论,我申请了它。 – amin