即使我发现哈德利对谷歌的论坛中发帖POSIXct和geom_vline,我无法完成它.我有一个时间序列,并希望绘制1998年,2005年和2010年的垂直线.我尝试使用ggplot和qplot语法,但我仍然看不到垂直线,或者在第一个垂直网格上绘制垂直线,整个系列在右边有点奇怪地移动.
gg <- ggplot(data=mydata,aes(y=somevalues,x=datefield,color=category)) +
layer(geom="line")
gg + geom_vline(xintercept=mydata$datefield[120],linetype=4)
# returns just the time series plot I had before,
# interestingly the legend contains dotted vertical lines
Run Code Online (Sandbox Code Playgroud)
我的日期字段格式为"1993-07-01",属于班级Date.