Python 如何从二维阵列中绘制特定值的极坐标图?

Python 如何从二维阵列中绘制特定值的极坐标图?,python,multidimensional-array,indexing,contour,polar-coordinates,Python,Multidimensional Array,Indexing,Contour,Polar Coordinates,如何在极坐标图中高亮显示特定等高线值 azi是极方位角(360度值)。 dev是与水平面的偏差度(值为90)。 W是一个二维阵列形状(90360),其值范围为0到110 我需要突出显示和勾勒出等于90的W值。 下面是我尝试过的代码: 但是,我得到了一个错误: TypeError: Input z must be at least a 2x2 array. 我不知道如何对等于90的2D-‘W’数组值进行等高线和索引 另一个解决方案可能是创建一个W==90值的新2D数组,并对这些值进行等高

如何在极坐标图中高亮显示特定等高线值

azi是极方位角(360度值)。
dev是与水平面的偏差度(值为90)。
W是一个二维阵列形状(90360),其值范围为0到110

我需要突出显示和勾勒出等于90的W值。
下面是我尝试过的代码:



但是,我得到了一个错误:

TypeError: Input z must be at least a 2x2 array.  
我不知道如何对等于90的2D-‘W’数组值进行等高线和索引

另一个解决方案可能是创建一个W==90值的新2D数组,并对这些值进行等高线

import numpy as np
import matplotlib.pyplot as plt

a=np.radians(np.linspace(0,360,360).round()) # borehole azimuth - degrees converted to radians
    d=np.radians(np.linspace(0,90,90).round())     # borehole deviation - degrees converted to radians
    azi,dip=np.meshgrid(a,d)  # create numpy array 90x360 for borehole deviation
    W=np.random.randint(80,100, size=(90,360))

# first we need to create a new 2D Numpy array (Z) from W where W=90
Z = np.zeros_like(W)
mask = np.isclose(W, 90)
Z[mask] = W[mask]

ax2 = plt.subplot(111, projection= 'polar')  
ax2.set_theta_direction(-1)  
ax2.set_theta_zero_location("N")  
data=ax2.contourf(azi,dip, W)  
plt.contour(azi, dip, Z)  # then plot contour using the new Z array
plt.colorbar(data)  
plt.show()

import numpy as np
import matplotlib.pyplot as plt

a=np.radians(np.linspace(0,360,360).round()) # borehole azimuth - degrees converted to radians
    d=np.radians(np.linspace(0,90,90).round())     # borehole deviation - degrees converted to radians
    azi,dip=np.meshgrid(a,d)  # create numpy array 90x360 for borehole deviation
    W=np.random.randint(80,100, size=(90,360))

# first we need to create a new 2D Numpy array (Z) from W where W=90
Z = np.zeros_like(W)
mask = np.isclose(W, 90)
Z[mask] = W[mask]

ax2 = plt.subplot(111, projection= 'polar')  
ax2.set_theta_direction(-1)  
ax2.set_theta_zero_location("N")  
data=ax2.contourf(azi,dip, W)  
plt.contour(azi, dip, Z)  # then plot contour using the new Z array
plt.colorbar(data)  
plt.show()