1
我有一個數據幀df
,其中包含R日期對象的列time
,我想繪製一個密度圖以查看哪些日子的活動最多。我不想轉換爲時間戳,因爲我希望在x軸上使用更多有意義的標籤。如何在ggplot2中使用x軸上的日期製作密度圖
我嘗試
這裏就是我想:
ggplot(df, aes(x = time)) + geom_density(stat="identity") + scale_x_date()
這給錯誤
Error in as.environment(where) : 'where' is missing
這裏是dput(df)
輸出:
structure(list(time = structure(c(15863, 15887, 15865, 15873, 15885, 15878), class = "Date")), .Names = "time", row.names = 8831395:8831400, class = "data.frame")
你能告訴'dput(DF)'(或者'dput(頭(DF))'如果它很大?) –
完成,參見上文。 – Peteris