简体   繁体   English

如何 plot 散点坐标

[英]How to plot a scatter of coordinates

I have the next lists:我有下一个列表:

pickup_nodes = [(42,29), (42,5),(69,134),(53,17)]拾取节点 = [(42,29), (42,5),(69,134),(53,17)]

dropoff_nodes =[(54,176),(40,41),(0,37),(96,114)] dropoff_nodes =[(54,176),(40,41),(0,37),(96,114)]

I want to draw a scatter of each list and differentiate between them with colors.........any help?我想绘制每个列表的散点图,并用 colors ......有什么帮助吗? each pair in each list represents (x,y)每个列表中的每一对代表 (x,y)

Here's a quick and dirty solution using matplotlib :这是使用matplotlib的快速而肮脏的解决方案:

import matplotlib.pyplot as plt
plt.scatter([i[0] for i in pickup_nodes], [i[1] for i in pickup_nodes], c='red')
plt.scatter([i[0] for i in dropoff_nodes], [i[1] for i in dropoff_nodes], c='blue')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM