0

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?

The image here is the heatmap

If you would like a copy of the data, you will find it here on kaggle

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • It's not clear to me why you think this plot is wrong. Can you make a more specific statement about something you expected to see but did not? Maybe even start off with a description of what you were trying to do. This code doesn't make a lot of sense on it's own. – MrFlick Apr 12 '17 at 03:00
  • If you would look at certain shaded areas, you will notice fairy is stronger in attack then it should be, likewise, steal should have the strongest defense but does not. – WorkInProgress_101 Apr 12 '17 at 13:47
  • I don't play pokemon so that's not a particularly convicing argument. It would be better if you could use data to back up that claim. It's also better if the question itself is [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and doesn't require downloading data from other websites to run and test. – MrFlick Apr 12 '17 at 14:31

0 Answers0