【发布时间】:2017-11-16 01:10:08
【问题描述】:
我正在编写代码来创建陨石坑密度图。本质上,每个新的陨石坑都被绘制成一个圆圈,并且圆圈可以相互重叠(因为新的陨石坑可以抹去旧的陨石坑)。我想知道是否有任何方法可以删除已覆盖的圆圈,或者创建一个计数器来仅计算有多少个不间断的圆圈?我的目标是计算有多少“新”陨石坑(圆圈)未被其他陨石坑抹去。第一个代码是我创建和绘制这些圆圈的代码(xx+1,yy+1 是添加“阴影”效果)。
fig, ax = pl.subplots()
#this is going to create a random list to pull center coordinates from
xcenter = np.random.randint(501, size = 500)
ycenter = np.random.randint(501, size = 500)
#start a counter at 0 so we can see the progression of time
time = 0
#now to zip the x and y center coordinates and make circles
for xx, yy in zip(xcenter, ycenter):
cratershadow = Circle((xx, yy),5, color = 'b')
ax.add_patch(cratershadow)
crater = Circle((xx+1, yy+1), 5, color = 'c')
ax.add_patch(crater)
time += 1
#setting the axiis(?) to be up to 500 km
ax.set_xlim((0,500))
ax.set_ylim((0,500))
pl.xlabel("X side, 500 km Field")
pl.ylabel("Y side, 500 km Field")
pl.title("Crater Density Plot - 500,000 years")
pl.show()
【问题讨论】:
-
这将有助于包含您的
import声明,我想出了它们并制作了情节。但问题超出了本论坛的范围 - 您需要决定一种方法是否面向对象只是第一选择
标签: python geometry erase graphing