Change distance between x-axis ticks in ggplot2

心已入冬 提交于 2019-11-29 10:57:23

Increase the first argument of the expand = argument of scale_x_discrete:

ggplot(glomor, aes(x=Time.Period, y=Score, group=Variable, shape=Variable,     
                   color=Variable, width=0.5)) +
geom_point() +
scale_x_discrete(limits = c("Jan 1997 - Aug 2003",
     "Sep 2003 - Jun 2005","Jul 2005 - Dec 2009"), expand=c(0.2, 0)) +
geom_line(aes(linetype=Variable), size=1.3) +
geom_point(size=4.4) +
scale_shape_discrete(name="", labels=c("Significant Z-Score", "Moran's I Z-Score")) +
scale_linetype_manual(values=c(1, 3), name="", 
                      labels=c("Significant Z-Score", "Moran's I Z-Score"))   +
scale_color_manual(values=c("black", "grey40"), name="",
                   labels=c("Significant Z-Score", "Moran's I Z-Score")) +
scale_fill_discrete(name="", labels=c("Significant Z-Score", "Moran's I Z-Score")) +
theme_classic()+
ylim(0,10) +
xlab("Time Periods") +
ylab("Moran's I Z-Score") +
theme(axis.text.x=element_text(size=11)) +
theme(axis.title.x=element_text(size=14, face="bold")) +
theme(axis.title.y=element_text(size=14, face="bold")) +
theme(legend.position=c(.80, .90)) +
theme(legend.text=element_text(size=12)) +
theme(legend.background = element_rect(fill="white", linetype="dashed")) +
theme(legend.key = element_blank()) 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!