Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/jamstats/plots/advanced_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@ def plot(self, derby_game: DerbyGame) -> Figure:
"team": [derby_game.team_1_name, derby_game.team_2_name],
"jammers": [sum(pdf_jammer_jamcounts.team == derby_game.team_1_name),
sum(pdf_jammer_jamcounts.team == derby_game.team_2_name)]
}), hue="team", legend=False,
}), hue="team",
ax=ax, palette=team_color_palette)
ax.get_legend().remove()
# word-wrap too-long team names
wordwrap_x_labels(ax)
ax.set_title("Jammers per team")

ax = axes[1]
sns.violinplot(x="team", y="jam_count", data=pdf_jammer_jamcounts, cut=0, ax=ax,
hue="team", legend=False,
hue="team",
palette=team_color_palette, inner="stick")
ax.get_legend().remove()
ax.set_title("Jams per jammer")
ax.set_ylabel("Jams per jammer")
# word-wrap too-long team names
Expand Down Expand Up @@ -289,10 +291,11 @@ def plot(self, derby_game: DerbyGame) -> Figure:
})
if len(pdf_plot) > 0:
sns.violinplot(y="first_scoring_pass_durations", x="Team",
data=pdf_plot, cut=0, ax=ax, hue="Team", legend=False,
data=pdf_plot, cut=0, ax=ax, hue="Team",
inner="stick", palette=team_color_palette)
ax.set_ylabel("Time to Initial (s)")
ax.set_title("Time to Initial per jam")
ax.get_legend().remove()
# word-wrap too-long team names
wordwrap_x_labels(ax)

Expand Down
21 changes: 14 additions & 7 deletions src/jamstats/plots/basic_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,35 +60,40 @@ def plot(self, derby_game: DerbyGame) -> Figure:
mypalette = sns.color_palette("rainbow", n_colors=n_jammers)

ax = ax0
sns.barplot(y="Jammer", x="Jams", hue="Jammer", legend=False,
sns.barplot(y="Jammer", x="Jams", hue="Jammer",
data=pdf_jammer_data, ax=ax, palette=mypalette)
ax.set_ylabel("")
ax.get_legend().remove()

ax = ax1
sns.barplot(y="Jammer", x="Total Score", hue="Jammer", legend=False,
sns.barplot(y="Jammer", x="Total Score", hue="Jammer",
data=pdf_jammer_data, ax=ax, palette=mypalette)
ax.set_yticks([])
ax.set_ylabel("")
ax.get_legend().remove()

ax = ax2
sns.barplot(y="Jammer", x="Mean Net Points", hue="Jammer", legend=False,
sns.barplot(y="Jammer", x="Mean Net Points", hue="Jammer",
data=pdf_jammer_data, ax=ax, palette=mypalette)
ax.set_xlabel("Mean Net Points/Jam\n(own - opposing)")
ax.set_yticks([])
ax.set_ylabel("")
ax.get_legend().remove()

ax = ax3
sns.barplot(y="Jammer", x="Proportion Lead", hue="Jammer", legend=False,
sns.barplot(y="Jammer", x="Proportion Lead", hue="Jammer",
data=pdf_jammer_data, ax=ax, palette=mypalette)
ax.set_xlim(0,1)
ax.set_yticks([])
ax.set_ylabel("")
ax.get_legend().remove()

ax = ax4
sns.barplot(y="Jammer", x="Mean Time to Initial", hue="Jammer", legend=False,
sns.barplot(y="Jammer", x="Mean Time to Initial", hue="Jammer",
data=pdf_jammer_data, ax=ax, palette=mypalette)
ax.set_yticks([])
ax.set_ylabel("")
ax.get_legend().remove()

f.set_size_inches(16, min(2 + len(pdf_jammer_data), 11))
f.suptitle(f"Jammer Stats: {team_name}")
Expand Down Expand Up @@ -202,12 +207,14 @@ def plot(self, derby_game: DerbyGame) -> Figure:
sns.barplot(y="prd_jam", x="Team with Lead", data=pdf_for_plot_all, ax=ax,
color="gray")
if len(pdf_for_plot_called_or_lost) > 0:
sns.barplot(y="prd_jam", x="Team with Lead", hue="Team with Lead", legend=False,
sns.barplot(y="prd_jam", x="Team with Lead", hue="Team with Lead",
data=pdf_for_plot_called_or_lost, ax=ax,
palette=team_color_palette)
if len(pdf_for_plot_lost) > 0:
sns.barplot(y="prd_jam", x="Team with Lead", hue="Team with Lead", legend=False,
sns.barplot(y="prd_jam", x="Team with Lead", hue="Team with Lead",
data=pdf_for_plot_lost, ax=ax, palette='dark:black')
if ax.get_legend() is not None:
ax.get_legend().remove()

ax.set_ylabel("Jams")
ax.set_title("Jams with Lead\n(black=lost, gray=not called)")
Expand Down
Loading