相关疑难解决方法(0)

如何删除圆内的一组网格网格点?

我正在尝试创建一个网格网格,而没有落入具有指定坐标和半径的圆内的某些点。我无法减去落入圆内的网格点。这是我的代码

import math
import numpy 
import matplotlib.pyplot as plt


N = 50
x_start, x_end = -2.0, 2.0 
y_start, y_end = -1.0, 1.0


x = numpy.linspace(x_start, x_end, N)
y = numpy.linspace(y_start, y_end, N)

circle_x, circle_y, r= 0.0, 0.0, 0.4

#x.remove((r-circle_x)**2)   #need some help with these two lines
#y.remove((r-circle_y)**2)


X, Y = numpy.meshgrid(x, y)


size = 10
fig = plt.figure()
plt.xlabel('x', fontsize = 16)
plt.ylabel('y', fontsize = 16)
plt.scatter(X, Y)
plt.show()
Run Code Online (Sandbox Code Playgroud)

显示网格点的meshgrid ##标题

python numpy matplotlib

4
推荐指数
1
解决办法
3464
查看次数

标签 统计

matplotlib ×1

numpy ×1

python ×1