I am working on a Pokémon dataset with the intention of creating a heatmap to asses the type of pokemon against some stats that were included in the dataset. I created a heatmap in order to help visualize this, and I am not sure the tiles are shaded correctly, as fairy type pokemon is a darker shaded then its supposed to be. If you look at my code here:
library(reshape2)
library(plyr)
library(scales)
library(tidyverse)
Selected_Stats <- pokemon %>% select(Speed, Sp_Atk, Sp_Def, Defense, Attack, HP, Type_1)
pokemon_m <- melt(Selected_Stats)
pokemon_m <- ddply(pokemon_m, .(variable), transform,
strength = rescale(value))
heatwave <- ggplot(pokemon_m, mapping = aes(Type_1, variable)) + geom_tile(aes(fill = strength),colour = "white") +
scale_fill_gradient(low = "white", high = "red") +
theme_classic(base_size = 10) + labs(x = "Pokémon Type" , y = "variable")
heatwave
It gives an inaccurate visualization; attached you will find the image. Would I need to remove some code?
If you would like a copy of the data, you will find it here on kaggle