本文整理汇总了Python中matplotlib.patches.Circle.radius方法的典型用法代码示例。如果您正苦于以下问题:Python Circle.radius方法的具体用法?Python Circle.radius怎么用?Python Circle.radius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.patches.Circle
的用法示例。
在下文中一共展示了Circle.radius方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shooting_plot
# 需要导入模块: from matplotlib.patches import Circle [as 别名]
# 或者: from matplotlib.patches.Circle import radius [as 别名]
def shooting_plot(shot_df, plot_size=(12,11), gridNum=30, mymap=plt.get_cmap('Spectral')):
from matplotlib.patches import Circle
x = shot_df.LOC_X[shot_df['LOC_Y']<425.1]
y = shot_df.LOC_Y[shot_df['LOC_Y']<425.1]
(shotVals, shotNumber) = find_shot_vals(shot_df, gridNum)
fig = plt.figure(figsize=plot_size)
cmap = mymap
ax = plt.axes([0.1, 0.1, 0.8, 0.8])
draw_court(outer_lines=False)
plt.xlim(-250,250)
plt.ylim(422.5, -47.5)
norm = mpl.colors.Normalize(vmin=-0.5, vmax = -0.1)
import math
def logistic(x):
return 20 / (1 + math.exp(-0.18*(x-np.median(shotNumber.get_array()))))
for i, shots in enumerate(shotVals):
restricted = Circle(shotNumber.get_offsets()[i], radius=shotNumber.get_array()[i],
color=cmap(norm(shots)),alpha=0.8, fill=True)
restricted.radius = logistic( np.sqrt(restricted.radius) )
if restricted.radius > 240/gridNum: restricted.radius=240/gridNum
ax.add_patch(restricted)
ax2 = fig.add_axes([0.92, 0.1, 0.02, 0.8])
cb = mpl.colorbar.ColorbarBase(ax2,cmap=cmap, orientation='vertical')
cb.set_label('next-possession value')
cb.set_ticks([0.0, 0.25, 0.5, 0.75, 1.0])
cb.set_ticklabels(['-0.5','-0.4', '-0.3','-0.2', '-0.1'])
plt.show()
return ax