使用POSIXt格式值突出显示绘图

时间:2017-07-20 12:11:21

标签: r plot highlight

我在y轴上有一个带时间(POSIXt)格式值的图。我需要突出显示一个部分但是为了定义矩形值,但我还需要突出显示所有y轴(使一个高亮框覆盖所有y轴)。

DF <- data.frame(DOY = 1:23, Photoperiod = 
c("8:52:41","8:53:35","8:54:33","8:55:36","8:56:44","8:57:55","8:59:11",
"9:00:31","9:01:55","9:03:23","9:04:55","9:06:31","9:08:10","9:09:53",
"9:11:40","9:13:30","9:15:23","9:17:20","9:19:20","9:21:23","9:23:29",
"9:25:38","9:27:49"))

DOY Photoperiod
1   08:52:41
2   08:53:35
3   08:54:33
4   08:55:36
5   08:56:44
6   08:57:55
7   08:59:11
8   09:00:31
9   09:01:55
10  09:03:23
11  09:04:55
12  09:06:31
13  09:08:10
14  09:09:53
15  09:11:40
16  09:13:30
17  09:15:23
18  09:17:20
19  09:19:20
20  09:21:23
21  09:23:29
22  09:25:38
23  09:27:49

DF<-as.POSIXct(DF$Photoperiod, format = "%H:%M:%S") 
i<- min(DF) 
b<- max(DF)

plot(DF, type="l")
box()
rect(4,i,10,b, col= 'lightgreen', density=65)

0 个答案:

没有答案