你如何使用ggplot在y轴上订购Day因子

时间:2015-01-21 20:35:34

标签: r ggplot2

我有这个数据框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")

我喜欢创建一个热图,其中day将是我的y轴,Month将是我的x轴。

当我这样做时:

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

yaxis不合适,我喜欢从星期一,星期二,星期三等订购。

我有什么想法可以做到这一点?

0 个答案:

没有答案