How to delete a set of meshgrid points inside a circle?

前端 未结 3 616
[愿得一人]
[愿得一人] 2021-01-13 22:10

I am trying to create a meshgrid without some of the points that falls within the circle having specified coordinates and a radius. I am not able to subtract the grid points

3条回答
  •  迷失自我
    2021-01-13 22:37

    One can not simply remove points from a meshgrid. Instead, you should create another array Z as

    Z = numpy.where((X-circle_x)**2+(Y-circle_y)**2>r**2,1,0)
    

    and plot it as

    plt.scatter(X,Y,Z)
    

提交回复
热议问题