Python 如何在matplotlib中检查ax是否为极轴投影?

Python 如何在matplotlib中检查ax是否为极轴投影?,python,matplotlib,cartesian,Python,Matplotlib,Cartesian,是否有来自fig或ax的属性可以指示ax的投影是否为极轴? 我正在尝试在一个更复杂的函数中创建一个基本嵌套函数,该函数基本上具有以下功能: is_polar(ax): return ax.some_attribute 尽管如此,我不确定这是否是可能的b/c我已经查看了这方面的明显属性。我想在我进行彻底的手动搜索之前,我会接触到社区 # Source | https://matplotlib.org/gallery/pie_and_polar_charts/polar_scatter.h

是否有来自
fig
ax
的属性可以指示ax的投影是否为极轴?

我正在尝试在一个更复杂的函数中创建一个基本嵌套函数,该函数基本上具有以下功能:

is_polar(ax):
    return ax.some_attribute
尽管如此,我不确定这是否是可能的b/c我已经查看了这方面的明显属性。我想在我进行彻底的手动搜索之前,我会接触到社区

# Source | https://matplotlib.org/gallery/pie_and_polar_charts/polar_scatter.html
# Fixing random state for reproducibility
np.random.seed(19680801)

# Compute areas and colors
N = 150
r = 2 * np.random.rand(N)
theta = 2 * np.pi * np.random.rand(N)
area = 200 * r**2
colors = theta

fig = plt.figure()
ax = fig.add_subplot(111, projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)

您可以使用
ax.name
根据检查投影。这包含作为字符串的投影,因此您可以简单地执行

if ax.name == 'polar':
    # ....