I have been working with the code below. Everything seems to work okay, except that the discrete values on the x-axis are far from each end of the graph. I\'ve tried several
With a factor you can add:
scale_x_discrete(expand=c(0, 0))
to plot all the way to the edges:
df <- data.frame(x=factor(letters[1:10]), y=rnorm(100), group=rep(letters[20:24], each=20))
p <- ggplot(df, aes(x=x, y=y, colour=group)) + geom_line()
c <- scale_x_discrete(expand=c(0, 0)
p
p + c
but I'm not sure exactly what you're trying for without some sample data.
Try it again, but convert vicryl.long$pre_post to a continuous numeric variable rather than a factor and it will plot to the edges, rather than center (as it should) as a categorical variable.
vicryl.long$pre_post <- as.numeric(as.character(vicryl.long$pre_post))