0

I have this data frame t

structure(list(Day = structure(c(4L, 5L, 3L, 1L), .Label = c("Fri", 
"Mon", "Thu", "Tue", "Wed"), class = "factor"), Month = structure(c(16436, 
16436, 16436, 16436), class = "Date"), Total = c(4, 4, 1, 1)), .Names = c("Day", 
"Month", "Total"), row.names = c(1L, 2L, 5L, 10L), class = "data.frame")

I like to create a heatmap where day will be my y-axis and Month will be my x-axis.

When I do this:

ggplot(t, aes(Month, Day, fill=Total)) + geom_tile()

yaxis is not in order, I like to order from Monday, Tues, Wed etc.

Any ideas how I could do this?

user1471980
  • 10,127
  • 48
  • 136
  • 235
  • @MrFlick, I couldn't find the link to the similiar questions, do you have it handy? – user1471980 Jan 21 '15 at 20:46
  • The duplicate is listed at the top of this question. Factors are always plotted in the order of their levels. So if you want to change the order of plot, change the levels. There are many, many duplicates of this question so It was hard to pick just one. – MrFlick Jan 21 '15 at 20:47

0 Answers0