使用matplotlib.patches.Arc可以使半椭圆形,只需指定关键字theta1=0.0, theta2=180.0(或90至270)。 我写了一个名为arcs的包装函数,用于制作Arc s的散点图。 它使用PatchCollection,应该有更好的性能并启用colorbar。 你可以在gist (link)找到它。
下面是一个例子:
a = np.arange(11)
arcs(a, a, w=4, h=a, rot=a*30, theta1=0.0, theta2=180.0,
c=a, alpha=0.5, edgecolor='none')
plt.colorbar()
的简要实施arcs张贴下面完整性埃德·史密斯建议。
def arcs(x, y, w, h, rot=0.0, theta1=0.0, theta2=360.0,
c='b', **kwargs):
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Arc
from matplotlib.collections import PatchCollection
if np.isscalar(c):
kwargs.setdefault('color', c)
c = None
zipped = np.broadcast(x, y, w, h, rot, theta1, theta