r - Add fake tick to x-axis in ggplot -


i suppose title says all. have dataset without data day 0, illustration purposes include day 0 on discrete x-axis, possible?
example code below, facetting necessary original data.

tmp=expand.grid(mig=c("a","b"),                 measure=c("rel", "abs"),                 mean=rnorm(1,2,3),                 day=factor(c(-14:-1,1:14), levels=c(-14:-1, 1:14))) tmp$group=with(tmp, paste(mig, measure)) ggplot(tmp, aes(x=day, y=mean, group=group))+     facet_grid(mig~measure)+     geom_line()+     scale_x_discrete(breaks=seq(-14,14,2)) 

if convert day integer or numeric seems work.

tmp$day <- as.integer(as.character(tmp$day))  ggplot(tmp, aes(x=day, y=mean, group=group))+   facet_grid(mig~measure)+   geom_line()+   scale_x_continuous(breaks=seq(-14,14,2)) 

fixing labels

edit: fixed breaks.


Comments