我正在制作一个简单的条形图,并用一些简单的数据重复一个旧脚本,但是它拒绝返回图形。
这里是数据帧的dput
:
papers <- structure(list(YEAR = c(1957, 1970, 1981, 1982, 1987, 1988, 1990,
1993, 1994, 1995, 1996, 2002, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018), count = c(1L,
1L, 1L, 2L, 1L, 14L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 3L, 4L, 5L,
3L, 5L, 4L, 6L, 5L, 13L, 4L, 5L, 6L, 12L, 2L)), row.names = c(NA,
-27L), class = "data.frame")
这是ggplot脚本:
ggplot(papers, aes(x=YEAR,y=count)) +
scale_y_continuous(limit=c(0,20),expand=c(0, 0)) +
scale_x_continuous(breaks=c(1955,1965,1975,1985,1995,2005,2015),
labels=c(1955,1965,1975,1985,1995,2005,2015)) +
geom_bar(stat="identity") +
theme(axis.text=element_text(size=10)) +
theme(panel.border = element_rect(colour = "grey50")) +
annotate("text",x=1948,y=18.5,label="ALL AREAS",
family="arial",size=5.5,hjust=0,color="black")
为什么不起作用?