I have constructed this plot in ggplot2:
Using this code:
m_date = c( rep("2015-09-13", 3), rep("2015-09-14", 3), rep("2015-09-15", 3))
M_date = as.Date(m_date)
M_hour = c(11, 12, 13, 11, 12, 13, 11, 12, 13)
M_Count = c(1, 2, 3, 4, 5, 6, 7, 8, 9)
M_WE = c(1, 1, 1, 0, 0, 0, 0, 0, 0)
Mock = data.frame(M_date, M_hour, M_Count, M_WE)
p1 = qplot(M_date, M_hour, fill=M_Count, data=Mock, geom="tile")
p1 = p1 + scale_x_date() + scale_y_reverse() + scale_fill_gradient(low = "white", high = "green2")
print(p1)
I want to try to vary the color of the gradient by the variable by the variable M_WE (I want the weekends to be blue, and the weekdays to be green.) Is it is possible? I was able to create new columns for weekend and weekday counts, and two separate graphs but then was not able to combine them.
Many Thanks! Dustin