I'm currently trying to make a basic heatmap of exit velocities (ExitSpeed) based on pitch location from some baseball game data. The resulting plot has the fill legend, but the plot area is completely blank, with the correct x and y labels. I can use geom_point to plot each individual pitch, but cannot get geom_tile to show anything. The data is coming from a saved csv, so the error messages in the reprex aren't occurring locally. My code follows:
library(readr)
library(ggplot2)
library(tidyverse)
library(reprex)
PennState <- read_csv("Baseball/PennState.csv")
#> Error: 'Baseball/PennState.csv' does not exist in current working directory ('/private/var/folders/jb/1ybpmzm91l74pccjfmt27f1w0000gq/T/RtmpbhBJd4/reprex1cf30d1e1').
WithEV <- PennState %>% filter(ExitSpeed > 0)
#> Error in eval(lhs, parent, parent): object 'PennState' not found
ggplot(WithEV, aes(x=PlateLocSide, y=PlateLocHeight)) +
geom_tile(color = "white", aes(fill = ExitSpeed)) +
scale_fill_gradient(low = "blue", high = "red")
#> Error in ggplot(WithEV, aes(x = PlateLocSide, y = PlateLocHeight)): object 'WithEV' not found
Created on 2019-12-25 by the reprex package (v0.3.0)