8
我有這樣一個數據幀的時間:繪製僅使用GGPLOT2
head(yy)
Team Date STime ETime
1 A 2012-03-06 07:03 10:13
2 A 2012-03-06 07:03 10:13
3 A 2012-03-06 07:03 10:13
4 A 2012-03-06 07:03 10:13
5 A 2012-03-06 07:03 10:13
6 A 2012-03-06 07:03 10:13
dput(YY)
dput(yy)
structure(list(Team = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "A", class = "factor"),
Date = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "2012-03-06", class = "factor"),
STime = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "07:03", class = "factor"),
ETime = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "10:13", class = "factor")), .Names = c("Team",
"Date", "STime", "ETime"), class = "data.frame", row.names = c(NA,
-50L))
我喜歡看的y軸從00:00 23:59在增加2小時,並能夠在STime值上繪製紅線。
我的財產以後這樣的,但它看起來不正確:
ggplot(yy, aes(Date, ETime, group="Team")) + geom_jitter(size=0.05) + facet_wrap(~ Team) + geom_hline(yintercept=yy$Stime, colour="red", size=2)
你會如何在GGPLOT2做到這一點?有人能給我指示/啓動我在正確的方向嗎?
問候,
你可以發佈結果'dput(df)'(或'dput(head(df))'如果它太大了,我們可以重現你的數據嗎? –
@DavidRobinson,我只是放置了輸出輸出。 – user1471980
您的數據沒有變化。如果你只是試圖製作一個插圖,你應該看一看[inkscape](http://inkscape.org/),它是一個很棒的免費軟件 - 比如R. –