I need to annotate the point on the scatterplot. But the arrow to annotate is white or transparent. I can barely see it on a white background(but it is there). I copied solutions and it doesn't work for me again but it does work if I run the same code in the solution notebook. I added facecolor = 'black' and it didn't work either.
Plus, my background of the scatterplot is grey, but it was white. It changed at some point. And I don't know why.
Can anyone explain what could go wrong? Thank you so much.
My code is:
teamName = 'OAK'
years = np.arange(2000, 2004)
for yr in years:
df = joined[joined['yearID'] == yr]
plt.scatter(df['salary'] / 1e6, df['W'])
plt.title('Wins versus Salaries in year ' + str(yr))
plt.xlabel('Total Salary (in millions)')
plt.ylabel('Wins')
plt.xlim(0, 180)
plt.ylim(30, 130)
plt.annotate(teamName,
xy = (df['salary'][df['teamID'] == teamName] / 1e6, df['W'][df['teamID'] == teamName]),
xytext = (-20, 20), textcoords = 'offset points', ha = 'right', va = 'bottom',
bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5),
arrowprops = dict(arrowstyle = '->', facecolor = 'black' , connectionstyle = 'arc3,rad=0'))
plt.show()
I know it's two years later (but somebody could stumble upon it using Google), but I think you need to add
edgecolor='black'
inarrowprops
.