Skip to content

Instantly share code, notes, and snippets.

@crawles
Last active January 24, 2017 19:00
Show Gist options
  • Save crawles/62a1a93f35446d07c8d27d28a14ccda8 to your computer and use it in GitHub Desktop.
Save crawles/62a1a93f35446d07c8d27d28a14ccda8 to your computer and use it in GitHub Desktop.
For Spark blog tutorial
from matplotlib import pyplot as plt
import seaborn as sns
plt.style.use('fivethirtyeight')
_df = fga_py.toPandas()
plt.plot(_df.yr,_df.fg3a_p36m, color = '#00a79c')
plt.xlabel('Year')
_=plt.title('Player average 3-point attempts (per 36 minutes)')
plt.annotate('3 pointer introduced', xy=(1980, .5), xytext=(1981, 1.1), fontsize = 12,
arrowprops=dict(facecolor='grey', shrink=0.05, linewidth = 2))
plt.annotate('NBA moved in 3-point line', xy=(1996, 2.4), xytext=(1991.5, 2.7), fontsize = 12,
arrowprops=dict(facecolor='grey', shrink=0.05, linewidth = 2))
plt.annotate('NBA moved back\n3-point line', xy=(1998, 2.), xytext=(1998.5, 2.4), fontsize = 12, arrowprops=dict(facecolor='grey', shrink=0.05, linewidth = 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment