Reputation:
I am using this data https://www.dropbox.com/s/aqt7bdhzlwdsxl2/summary_exp1.csv
And the following code:
pd <- position_dodge(.1)
ggplot(data=summary.200.exp1, aes(x=Time, y=Length, colour=Genotype, group=Genotype)) +
geom_errorbar(aes(ymin=Length - se, ymax=Length + se), colour="black", width=.1, position=pd) +
geom_line(position=pd) +
geom_point(aes(shape=Genotype),position=pd, size=3) +
ylab("leaf segment width (mm)") +
xlab("Time") +
theme(axis.title = element_text(size=14,face="bold"),
axis.text = element_text(size=14),
strip.text.y = element_text(size=14))
I need to make the following modifications:
time0
and then between Time22
and the edge of the graph. I have looked at documentation and tried this:
scale_x_discrete(limits=c("0","22"))
, but it doesn't work.geom_text(aes(colour=Genotype))
, which I also cannot get to work.I would appreciate any help with this. Many thanks
Upvotes: 2
Views: 478
Reputation: 83215
expand = c(0, 0)
to the scale parameter:scale_x_discrete(expand = c(0, 0))
show_guide=FALSE
to e.g. the geom_line
part of your code.EDIT:
I think your are trying to plot to much into one graph. The errorbars, for example, overlap each other to much to get a readable plot. Using facets might be a good idea in this case (in my opinion). the following code (in which named the dataframe as dat
):
ggplot(data=dat, aes(x=Time, y=Length, colour=Genotype)) +
geom_line() +
geom_point(aes(shape=Genotype), size=3) +
scale_shape_manual(values=c(19,17,15,8,13,6,12,4)) +
geom_errorbar(aes(ymin=Length-se, ymax=Length+se, colour=Genotype), width=.2) +
guides(colour=FALSE, shape=FALSE) +
facet_wrap(~Genotype, ncol=4)
results in this plot:
Upvotes: 1