I am trying to make my data points that are equal to 0 appear on the x axis and avoid having data points cut by the axis. I also want to keep my origin as it is (same 0 for both axis).
I used this to obtain the origin at 0 and to set the limits of my axis:
scale_y_continuous(limits = c(0, 40), expand = c(0, 0))+
scale_x_continuous(limits = c(0, 30), expand = c(0, 0))
If I change the limit of y for
scale_y_continuous(limits = c(-1, 40))
it also changes the origin...
Here is all I my code in case you need it:
require(ggplot2)
myplot<-ggplot(data=NULL,aes(x = Length, y = Complete)) +
geom_point(data = C,shape=1, size=3)+
geom_point(data = T, size=3)+
scale_y_continuous(limits = c(0, 40), expand = c(0, 0))+
scale_x_continuous(limits = c(0, 30), expand = c(0, 0))+
xlab("Inflorescence Length (cm)")+
ylab("Successful Weevils")+
theme_bw() +
theme(panel.border = element_blank())+
theme(panel.grid.major = element_blank())+
theme(panel.grid.minor = element_blank())+
theme(axis.text=element_text(size=12))+
theme(axis.title=element_text(size=14,face="bold"))+
theme(axis.line.x=element_line())+
theme(axis.line.y=element_line())+
theme(plot.margin = unit(c(1,1,1,1), "cm"))+
stat_smooth(data = C, method = lm, se=FALSE, color="grey")+
stat_smooth(data = T, method = lm, se=FALSE, color="black")
myplot
Thank you!