My graph has a data-point-sized gap before and after the trend line. I already factored the data to include only the days that I want- the days are put in as character data to prevent it from using days on the x axis that I don't want, as I'm using only Days 0, 1, 3, 7, 10 (not consistent spacing). see photo.
plot <- ggplot(N2O_Methylocella[!is.na(N2O_Methylocella$Day), ], aes(x = Day, y = N2O, colour = Amendment)) +
geom_point(size = 1, alpha = 1) +
geom_smooth(aes(group="Amendment"), method = lm, level = 0.95) +
facet_grid("Amendment", switch = "both") +
xlab("Day") +
ylab(expression(phantom()*"Total "*N[2]*"O Production (%)")) +
ggtitle(my_title) +
scale_fill_npg(alpha = 0.8) +
guides(colour = FALSE, size = FALSE) +
theme(text=element_text(size=24), panel.grid.minor = element_blank())
results in the photo above.
Trying to add scale_x_discrete(c("1", "10")) results in no change, and expand(c(0,0)) as recommended for scale_x_continuous doesn't work for discrete.
I just want to cut out the weird gaps.