This paste brought to you by Pastebin. View Raw
generate_team_chart
<- function(team_name
) {
plot
<- halfP
+ geom_hex
(data = subset(shot_logs, team
== team_name
),
aes(x =converted_x ,
y =converted_y,
fill
= cut(..
count..,
c(0,
1,
2,
5,
10, Inf
))),
colour = "lightblue",
binwidth = 1,
alpha = 0.75) +
scale_fill_manual
(values
= c("grey98",
"slategray3",
"yellow",
"red" ,
"black"),
labels = c("1",
"2",
"2-5",
"5-10",
"11+"), name
= "Count")+
ggtitle
(paste(team_name,
"Total Shots"))
}