--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
ggplot(data=infomerge, aes(x=siControl, y=siCATS)) + geom_point(aes(colour=as.factor(group))) + geom_text(aes(label=Name), size=2)+ geom_smooth(method="lm")
Previously it was treating "Group" as a numeric and giving a scale, but if they are factors (and I think they are) then using as.factor() is what you need. You'll have to clean up the legend, but I think that's what you're after. 1 smooth line for all the data, different colors for the points, and labels for the points.
>
> I'm not sure if I got there in the end or not, but this is what I got to.
>
> infomerge<-structure(list(Name = structure(1:4, .Label = c("Point1",
> "Point2", "Point3", "Point4"), class = "factor"), siControl = 0:3, siCATS =
> c(3L, 1L, 3L, 2L), group = c(1L, 1L, 2L, 2L)), .Names = c("Name",
> "siControl", "siCATS", "group"), row.names = c(NA, -4L), class =
> "data.frame")
Yes, you have the right idea of what I'm aiming for but I don't
understand what the above is for. I simply used the second part of
your solution.
geneexp <- read.csv(file.choose())
responseTCF7L2<-read.csv(file.choose())
geneexpmerge <- merge(geneexp, responseTCF7L2, by="gene")
df = data.frame(siControl =geneexpmerge$value_siCONTROL,
siTCF7L2=geneexpmerge$value_siTCF7L2, genelab=geneexpmerge$gene,
Group=geneexpmerge$Group)
ggplot(data=df, aes(x=siControl, y=siTCF7L2)) +
geom_smooth(method="lm" ) + coord_trans(x = "log", y = "log") +
geom_point(aes(colour=as.factor(Group))) +
geom_text(aes(label=genelab), size=2)
and it got me mostly what I want except the trendline bends and
doesn't look like its going through the points. I've tried different
things but its either use regular scale and have the points crammed
together or use log and have the bendy trendline.