I was wondering what you guys think is the best number of bins to use in this example. I am making a heat map of swing and misses for a certain baseball player.
stat_density2d(data=troutswing,aes(x = plate_x, y = plate_z, fill = as.numeric(..level..)),
geom = "polygon",show.legend = FALSE,bins=5) +
geom_point(data=troutswing,aes(x = plate_x, y = plate_z), color="black", size=.95) +
xlab("plate_x")+ylab("plate_z")+xlim(-2,2)+ylim(0,4.5)+scale_fill_gradient2(mid = "yellow",high = "red",
midpoint = 0)+theme_classic()+geom_path(data=xxx, aes(x=xx,y=zz))+geom_path(data=sz,
ggtitle("Whiffs")+ theme(plot.title = element_text(hjust = 0.5))
In these pictures, I have bins set as 5 & 30. I am not sure how to choose the best number.