def _plot_mpl(scheme):
# pylint: disable=relative-import, unused-variable
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_aspect('equal')
flt = numpy.vectorize(float)
pts = flt(scheme.points)
wgs = flt(scheme.weights)
for p, w in zip(pts, wgs):
# <https://en.wikipedia.org/wiki/Spherical_cap>
w *= 4 * numpy.pi
theta = numpy.arccos(1.0 - abs(w) / (2*numpy.pi))
color = '#1f77b4' if w >= 0 else '#d62728'
_plot_spherical_cap_mpl(ax, p, theta, color)
ax.set_axis_off()
return
评论列表
文章目录