0
由於某些原因,如果我嘗試使用以下代碼顯示數據,我會得到正確的座標軸,但實際數據不會繪圖。有什麼建議麼?當在R中指定座標軸時,數據點不顯示
par(bg="lightgray")
adates <-as.Date(row.names(try),format="%Y-%m-%d")
plot(try[,1],x=adates,type="o",axes=FALSE, ann=FALSE)
usr <- par("usr")
rect(usr[1], usr[3], usr[2], usr[4], col="cornsilk", border="black")
lines(try[,1], col="blue")
axis(2,col.axis="blue",,at=pretty(try[,1]),las=1,labels=sprintf("$%1.0f",pretty(try[,1]/1000)),cex.axis=.75)
axis.Date(1, at=pretty(adates), label=format(pretty(adates),"%y"))
box()
title(main="This is a graph", font.main=4, col.main="red",xlab="Date",ylab="$ (in $1000s)")
顯示您的數據示例,'嘗試'。 – 2012-02-07 12:56:05
......並且不要調用你的數據'try',因爲這是一個處理錯誤的函數。 – 2012-02-07 13:47:23
你知道日期是以1970年爲單位的天數表示的數值,對吧? – 2012-02-07 13:47:31