Resize hexagons according to the frequency of shots binned in the hexagon cell.
1 | resize_hexes(hex_grid)
|
1 2 3 4 5 6 7 8 9 10 | # Construct hexagon shot chart (area/color varying)
hex_grid <- half_court_hex(cellsize = 20)
hex_grid <- merge_shot_data(hex_grid, dat_filt, hex = TRUE)
resized_hexes <- resize_hexes(hex_grid)
# Plot hexagon shot chart
breaks <- seq(0, max(hex_grid@data$FGP, na.rm = TRUE), length.out = 10)
plotclr <- c("#236e96", "#15b2d3", "#5abccc", "#ffbe42", "#ff7f00", "#f4543b", "#f4143b")
colcode <- plotclr[findInterval(resized_hexes@data$FGP, breaks)]
draw_halfcourt()
plot(resized_hexes, col = colcode, border = NA, add = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.