'
pitchLength = 120
pitchWidth = 75
createPitch(pitchLength,pitchWidth,'meters','white')
ax = plt.subplot()
for index,col in rf_pass.iterrows():
x_start = col['location'][0]
y_start = col['location'][1]
x_end = col['pass.end_location'][0]
y_end = col['pass.end_location'][1]
if col['period'] == 1 or col['period'] == 3:
if(pitchLength - x_start < 60) and (col['play_pattern.name'] != 'From Throw In'):
#pass_org = plt.Circle((pitchLength - x_start,y_start),radius = 3,color = 'red')
pass_end = plt.plot(pitchLength - x_end,y_end,'c*', markersize=15)
#plt.text(pitchLength - x_start+2,y_start,col['minute'])
#trip_pass.set_alpha(0.3)
#ax.add_patch(pass_org)
ax.add_patch(pass_end)
elif col['period'] == 2 or col['period'] == 4:
if(pitchLength - x_start < 60) and (col['play_pattern.name'] != 'From Throw In'):
pass_org = plt.Circle((x_start,pitchWidth - y_start),radius = 3,color = 'blue')
#trip_pass.set_alpha(0.3)
ax.add_patch(pass_org)
'
I get the error
AttributeError Traceback (most recent call last)
<ipython-input-51-347f68947c51> in <module>()
16 #trip_pass.set_alpha(0.3)
17 #ax.add_patch(pass_org)
---> 18 ax.add_patch(pass_end)
19 elif col['period'] == 2 or col['period'] == 4:
20 if(pitchLength - x_start < 60) and (col['play_pattern.name'] != 'From Throw In'):
1 frames
/usr/local/lib/python3.6/dist-packages/matplotlib/axes/_base.py in _set_artist_props(self, a)
903 def _set_artist_props(self, a):
904 """set the boilerplate props for artists added to axes"""
--> 905 a.set_figure(self.figure)
906 if not a.is_transform_set():
907 a.set_transform(self.transData)
AttributeError: 'list' object has no attribute 'set_figure'
This error happens when i use 'plt.plot' for pass_end, but when i use 'plt.Circle' function it works fine. I have trouble understanding how the sub_plot() works ? Why does it show error when i use the 'plt.plot()?
I was trying to plot the point with a different symbol, that's why i used the
plt.plot(pitchLength - x_end,y_end,'c*', markersize=15)
Is there any other way to introduce new symbols ?