极轴散点图

在本例中,尺寸呈放射状增加,颜色随角度增加(只是为了验证符号是否正确分散)。

import numpy as np
import matplotlib.pyplot as plt


# 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)
polar scatter

极轴散点图,带偏移原点

与上一图的主要区别是原点半径的配置,产生了一个环空。此外,θ零点位置设置为旋转绘图。

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

ax.set_rorigin(-2.5)
ax.set_theta_zero_location('W', offset=10)
polar scatter

极轴上局限于扇形的散点图

与之前绘图的主要区别在于theta开始和结束限制的配置,生成一个扇区而不是一个完整的圆。

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

ax.set_thetamin(45)
ax.set_thetamax(135)

plt.show()
polar scatter