0

I have some data that I would like to convert into a heat map as like the MSFT one in this post Most underused data visualization:

Date    temp  week    wday    year
2013-01-02  -21  1   3   2013
2013-01-03  -22  1   4   2013
2013-01-04  -23  1   5   2013
2013-01-07  0  2   1   2013
2013-01-08  25  2   2   2013
2013-01-09  26  2   3   2013
2013-01-10  27  2   4   2013
2013-01-11  28  2   5   2013
2013-01-14  29  3   1   2013

hmap <- read.csv("heatmaptest.txt", as.is=TRUE)
hmap <- transform(hmap,
  week = as.POSIXlt(Date)$yday %/% 7 + 1,
  wday = as.POSIXlt(Date)$wday,
  year = as.POSIXlt(Date)$year + 1900)

library(ggplot2)
ggplot(hmap, aes(week, wday, fill = temp)) + 
  geom_tile(colour = "white") + 
  scale_fill_gradientn(colours = c("#D61818","#FFAE63","#FFFFBD","#B5E384")) + 
  facet_wrap(~ year, ncol = 1)

How can I assure that, in this instance the color green on the heat map will start at numbers >=x, for purpose of example lets say >=25,

ie make an immediate instead of a gradual change through the 4 hexidecimal codes

Community
  • 1
  • 1
Rhodo
  • 1,234
  • 4
  • 19
  • 35

0 Answers0