将注释放在一起,并添加一些随机数据帧,结果是:
library(ggplot2)
disDataHeadItems <- data.frame(
x = runif(100,1,100),
Freq = runif(100,5,10)
)
disDataLongTail <- data.frame(
x = runif(100,1,100),
Freq = runif(100,5,10)
)
ggplot() +
geom_line(data = disDataHeadItems, aes(x=x,
y=Freq)) +
geom_line(data = disDataLongTail, aes(x=x,
y=Freq)) +
xlab("Item id") +
ylab("# of occurrences") +
scale_x_continuous(breaks=seq(5, 75, 10), expand = c(0, 0)) +
scale_y_continuous(expand = c(0, 0)) +
geom_ribbon(aes(ymin=0, ymax=disDataHeadItems$Freq,
x=disDataHeadItems$x, fill="#CC6666")) +
geom_ribbon(aes(ymin=0, ymax=disDataLongTail$Freq,
x=disDataLongTail$x, fill="#66CC99")) +
geom_vline(xintercept=19, linetype="dotted")