Suppose we have a data frame df
that looks like:
team_1 team_2 team_3
very_effective 3 5 8
effective 5 6 9
ineffective 6 8 20
I want to create a heatmap that has different colour squares which are darker if the value is higher. I tried the following code but I get the error object 'X1' is not found
. Does anyone know how to fix? Thanks!
library(ggplot2)
ggp <- ggplot(df, aes(X1, X2)) # Create heatmap with ggplot2
geom_tile()
ggp
CodePudding user response:
aes()
expects vectors for x- and y-values; not a crosstable, and also not undefined variables:
Usage
aes(x, y, ...)