I believe I am close to correctly duplicating my scatterplot with a hexbin plot.
My current scatterplot:
ggplot(shotchart[shotchart$player_id==X,], aes(as.numeric(V1), as.numeric(V2))) +
annotation_custom(court, -3, 100, -102, 3) +
geom_point(aes(colour = class, alpha = 0.8), size = 3) +
scale_color_manual(values = c("#008000", "#FF6347")) +
guides(alpha = FALSE, size = FALSE) +
xlim(-1, 102) +
ylim(102, -3) +
coord_fixed()
What the scatterplot looks like:
My hexbin plot:
ggplot(shotchart[shotchart$player_id==X,], aes(x=as.numeric(V1), y=as.numeric(V2))) +
annotation_custom(court, -3, 100, -102, 3) +
geom_hex(aes(alpha= .3, fill = class, bins = 25))+
guides(alpha = FALSE, size = FALSE) +
xlim(-1, 102) +
ylim(102, -3) +
coord_fixed()
What the hexbin plot looks like:
I believe both plots are saying the same thing. From the plots I want to be able to see where the "shots" were taken and if the shot was a "made" or "missed" The scatterplot portrays this perfectly. But for the hexbin it is not correctly displaying "made' or "missed"
I have circled the major problem areas in the hexbin plot.
The areas that are dark blue should actually be a dark red. The areas in the scatterplot that are green and dark green should be red and dark red in the hexbin plot. I have tried changing the alpha
in the hexbin plot but I have not been able to change the dark blue into dark red.
Any help will be appreciated. I am new to using ggplot so please let me know if any further information is needed.