对于R中的一般情节,legend
用于对数字进行编号。
set.seed(100)
Mydata=rnorm(65)
Year=1950:2014
plot(x=Year,y=Mydata,type = "l")
legend("topleft","(a)",bty = "n")
答案 0 :(得分:5)
使用网格可以独立于数据完成:
library(ggplot2)
qplot(Year, Mydata, geom = "line")
library(grid)
grid.text("(a)", 0.15, 0.85)
答案 1 :(得分:3)
从版本2.2.0开始,ggplot2
允许绘制可用于此目的的字幕和字幕。
# create data frame as required by ggplot2
mydf <- data.frame(Year, Mydata)
library(ggplot2)
p <- ggplot(mydf, aes(Year, Mydata)) +
geom_line()
# plot subtitle (top left)
p + labs(subtitle = "(a)")
# plot caption (bottom right)
p + labs(caption = "(a)")
答案 2 :(得分:2)