日付の場合
a <- as.Date(c("2017/4/15","2017/5/2","2017/8/31")) b <- c(2,8,7) par(xaxt="n") plot(a,b,type="b",ylim=c(0,10),xlab="time",ylab="value") par(xaxt="s") axis.Date(1,at=seq(min(a),max(a),"month"),format="%m月%d日")
時間の場合
a <- as.POSIXct(c("11:15","13:45","19:59"),format="%H:%M") b <- c(2,8,7) par(xaxt="n") plot(a,b,type="b",ylim=c(0,10),xlab="time",ylab="value") par(xaxt="s") time_start <- as.POSIXct("00:00",format="%H:%M") time_end <- as.POSIXct("24:00",format="%H:%M") axis.POSIXct(1,at=seq(time_start,time_end,"hour"),format="%H時")
クリップボードからグラフを作成
2017/5/5 | 2017/7/1 | 2017/10/28 | 2017/12/7 | |
---|---|---|---|---|
Value | 1.2 | 1.3 | 2.0 | 1.9 |
Value <- read.table(file = "clipboard", header = T, sep = "\t", check.names = FALSE, row.names = 1) Date <- as.Date(colnames(Value)) par(xaxt = "n") plot(Date, Value, type = "b") par(xaxt = "s") axis.Date(1, at = seq(min(Date), max(Date), "month"), format = "%m月%d日")