我正在使用以下数据集。现在,当我按照ggplot命令所示绘制它时,x轴将年份值分为2000,2002.5,2005,2007.5,依此类推,而不是2001,2002,2003,2004,依此类推。可以做些什么来解决这个问题?
d1<-structure(list(year = structure(1:10, .Label = c("2001", "2002",
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010",
"2011", "2012"), class = "factor"), val1 = c(42244L, 43161L,
42444L, 43579L, 43424L, 45116L, 48003L, 48835L, 47856L, 50024L
), val2 = c(0L, 0L, 0L, 0L, 18L, 0L, 0L, 7L, 0L, 0L), val3 = c(109467L,
112956L, 110623L, 125657L, 127560L, 137180L, 156412L, 164861L,
174395L, 180413L), val4 = c(20381L, 18346L, 16636L, 18119L, 17173L,
19234L, 22113L, 22624L, 23374L, 23280L), val5 = c(7056L, 6679L,
6287L, 6261L, 7197L, 7581L, 10321L, 10535L, 10242L, 12080L),
val6 = c(12823L, 12056L, 11101L, 11428L, 12665L, 11783L,
9861L, 8250L, 7802L, 6775L), val7 = c(220L, 101L, 55L, 68L,
212L, 85L, 95L, 125L, 49L, 81L), val8 = c(694L, 2527L, 1066L,
1700L, 2976L, 1665L, 1229L, 1086L, 879L, 958L), val9 = c(12439L,
12698L, 15351L, 12771L, 13192L, 12420L, 13753L, 14943L, 14368L,
10404L), val10 = c(17819L, 18221L, 15643L, 19250L, 19326L,
20967L, 23658L, 27208L, 30526L, 34250L), val11 = c(20446L,
21236L, 19994L, 22489L, 23212L, 23792L, 25363L, 25036L, 25845L,
27074L), val12 = c(243589L, 247981L, 239200L, 261322L, 266955L,
279823L, 310808L, 323510L, 335336L, 345339L)), .Names = c("year",
"val1", "val2", "val3", "val4", "val5", "val6", "val7", "val8",
"val9", "val10", "val11", "val12"),
row.names = c(NA, 10L), class = "data.frame")
然后我跑
d2<-(d1[,c(1,2)]) #(here d1 is the main (csv)file)
ggplot(d2,aes(x=year,y=val1))+geom_line()+geom_point()
由于