Skip to content

Commit

Permalink
fix: updated end of chapter exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanbraun committed Jun 18, 2024
1 parent e72c438 commit e71e7f7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions solutions-to-exercises/06_plotting_answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,44 @@
###############################################################################

g = (sns.FacetGrid(dfpg)
.map(sns.kdeplot, 'time_ice_pp', shade=True))
g.fig.subplots_adjust(top=0.9)
g.fig.suptitle('Distribution of Power Play Time')
.map(sns.kdeplot, 'time_ice_pp', fill=True))
g.figure.subplots_adjust(top=0.9)
g.figure.suptitle('Distribution of Power Play Time')
g.savefig('./solutions-to-exercises/6-1a.png')

# 6.1b
g = (sns.FacetGrid(dfpg, hue='pos')
.map(sns.kdeplot, 'time_ice_pp', shade=True))
g.fig.subplots_adjust(top=0.9)
g.fig.suptitle('Distribution of Power Play Time by Position B')
.map(sns.kdeplot, 'time_ice_pp', fill=True))
g.figure.subplots_adjust(top=0.9)
g.figure.suptitle('Distribution of Power Play Time by Position B')
g.savefig('./solutions-to-exercises/6-1b.png')

# 6.1c
g = (sns.FacetGrid(dfpg, col='pos', col_wrap=3)
.map(sns.kdeplot, 'time_ice_pp', shade=True))
g.fig.subplots_adjust(top=0.8)
g.fig.suptitle('Distribution of Power Play Time by Position C')
.map(sns.kdeplot, 'time_ice_pp', fill=True))
g.figure.subplots_adjust(top=0.8)
g.figure.suptitle('Distribution of Power Play Time by Position C')
g.savefig('./solutions-to-exercises/6-1c.png')

# 6.1d
g = (sns.FacetGrid(dfpg, col='pos', hue='pos', col_wrap=3)
.map(sns.kdeplot, 'time_ice_pp', shade=True))
g.fig.subplots_adjust(top=0.8)
g.fig.suptitle('Distribution of Power Play Time by Position D')
.map(sns.kdeplot, 'time_ice_pp', fill=True))
g.figure.subplots_adjust(top=0.8)
g.figure.suptitle('Distribution of Power Play Time by Position D')
g.savefig('./solutions-to-exercises/6-1d.png')

# 6.1e
g = (sns.FacetGrid(dfpg, col='team', col_wrap=6)
.map(sns.kdeplot, 'time_ice_pp', shade=True))
g.fig.subplots_adjust(top=0.9)
g.fig.suptitle('Distribution of Power Play Time by Team D')
.map(sns.kdeplot, 'time_ice_pp', fill=True))
g.figure.subplots_adjust(top=0.9)
g.figure.suptitle('Distribution of Power Play Time by Team D')
g.savefig('./solutions-to-exercises/6-1e.png')

# #### 6.2
# 6.2a
g = sns.relplot(x='time_ice_pp', y='time_ice_sh', data=dfpg)
g.fig.subplots_adjust(top=0.9)
g.fig.suptitle('Power Play vs. Short Handed Time')
g.figure.subplots_adjust(top=0.9)
g.figure.suptitle('Power Play vs. Short Handed Time')
g.savefig('./solutions-to-exercises/6-2a.png')

# 6.2b
Expand Down

0 comments on commit e71e7f7

Please sign in to comment.