0
如果考慮下面的代碼:排序ggplot傳說的因素(這裏:月)
library(ggplot2)
df <- as.data.frame(matrix(rnorm(8),4,2))
colnames(df) <- c("x","y")
df$dates <- as.factor(c("april", "may", "june", "august"))
ggplot(df, aes(x=x, y=y, color=dates)) + geom_point(size=3, shape=20)
我如何排序的幾個月的時間序列的傳奇?
可能重複(http://stackoverflow.com/questions/12075037/ggplot-legends-change-labels順序和標題) – Henrik 2014-10-08 13:35:29
你好。爲什麼不使用'factor'函數的'levels'參數?df $ dates < - factor(df $ dates,levels = df $ dates [c(4,1,3,2)]) – agenis 2014-10-08 13:48:58