我正在繪製一個軟件版本到它發佈的日期。例如:如何在X軸上放大日期?
test.cvs
Version,Date
0.302,23/2/2011
0.301,26/1/2011
0.215,28/4/2010
0.106,19/12/2008
0.069,21/3/2008
要繪製我使用:
tbl <- read.csv("test.csv")
dates <-strptime(as.character(tbl$Date), "%d/%m/%Y")
plot(dates,tbl$Version,type="o",main="Releases", xlab="Date",ylab="Version")
它通過一年繪製它雖然,我寧願希望按月/年繪製,並將標籤垂直打印。我怎麼能做到這一點?我嘗試設置xaxt =「n」,並使用帶有label = format(data,fmt)的axis()函數,但是我保持失敗。
dput數據的片段:
structure(list(Version = c(0.302, 0.301, 0.215, 0.106, 0.069),
Date = structure(c(3L, 4L, 5L, 1L, 2L), .Label = c("19/12/2008",
"21/3/2008", "23/2/2011", "26/1/2011", "28/4/2010"), class = "factor")), .Names = c("Version",
"Date"), class = "data.frame", row.names = c(NA, -5L))
我喜歡這個答案,因爲它給出了網格並且很短,但我選擇了另一個,因爲它有很多我不知道的有用信息。謝謝你 – ForeverConfused 2011-04-20 18:30:06