【发布时间】:2020-06-03 20:01:37
【问题描述】:
我有两个填充了 X 和 Y 值的数组。这些值是从用户填写的文本框中提取的。
这些值 (x1,y1), (y1,y2), (x_nth, y_nth) 被绘制出来,其中 n 是我的数组中的点数。
我想遍历这些坐标对并找到相互重叠的坐标。一旦找到确定的重叠点,我就可以将重复标记的大小更改为更大,以便读者可以看到重复点的频率。现在我只想完成前者。
我不熟悉 VBA,我主要使用 Python 工作。下面是我在 python 中工作的示例代码。
x = [1,2,2,4,5,5,5]
y = [1,3,3,4,5,5,5]
pts = []
for i in range(len(x)):
cX = x[i]
cY = y[i]
if (cX, cY) in pts:
print("duplicate")
print(cX, cY)
#plot this point on scatter
#increase marker size for this particular point
else:
pts.append((cX, cY))
print(pts)
输出
Duplicate
2 3
Duplicate
5 5
Duplicate
5 5
[(1,1), (2, 3), (4,4), (5,5)]
【问题讨论】:
标签: python vba duplicates