0

The following code produces a heatmap but shows labels on the y axis for all 194 countries included in the original dataset (before sampling). This continues to happen even if I remove the original dataset. I've also tried shutting down the console to start a new session, to no avail.

qlife.s <- myData[sample(194,size=10,replace=F),]

qlife.s.m <- melt(qlife.s)

qlife.s.m <- ddply(qlife.s.m, .(variable), transform, rescale=rescale(value))

(p <- ggplot(qlife.s.m, aes(variable, qlife.s.m$Country))
      + geom_tile( aes(fill = rescale),
                   colour = "white")
      + scale_fill_gradient(low = "red", high = "green")
)

Any advice is much appreciated. Thanks in advance.

Ferdinand.kraft
  • 12,579
  • 10
  • 47
  • 69

1 Answers1

4

Use droplevels() on your data. By the looks of things:

qlife.s.m <- droplevels(qlife.s.m)

should do what you want, but it is difficult to tell without a reproducible example.

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453