0
這些是我的簡單的數據(table.all):標籤上的x軸的barplot和非工作ggplot代碼
YR count
2001 8
2002 25
2003 24
2004 26
2005 34
2006 37
2007 61
2008 46
2009 49
2010 54
2011 35
我要繪製的數量,都與barplot和ggplot,但這barplot代碼無法繪製年x軸標籤:
barplot((table.all$count),axes=T,ylim=c(0,80),
cex.names=0.8,las=2,
main=paste("Number of peer-reviewed papers"))
這ggplot代碼沒有告訴我任何東西,這是奇怪的,因爲我已經重複使用一些代碼,我已經使用,並已在工作其他數據:
ggplot(table.all, aes(x=YR,y=count)) + ylim(0,80) + xlim(2000,2016)
scale_y_continuous(expand = c(0, 0)) +
geom_bar(stat='identity') +
theme_bw(base_size = 16,base_family = "Times") +
annotate("text",x=2.5,y=14.9,
label="Total number of peer-reviewed papers",cex=7)
您是否嘗試過轉換的年份爲因子變量並應用該解決方案? http://stackoverflow.com/q/16350720/3250126 – loki