Skip to content
Back to formatted view

Raw Message

Message-ID: <f8e6ff050809191054h504312a8q796aa578fdf5164a@mail.gmail.com>
Date: 2008-09-19T17:54:44Z
From: Hadley Wickham
Subject: reproduce this graph in ggplot2 (code and data included)
In-Reply-To: <93d6f2a80809191045u3bc3d902uf81370e07126b5d7@mail.gmail.com>

Here's one way:

qplot(degreedays, therms, data=heating, colour = Location, shape = Location) +
 geom_smooth(method = "lm", fullrange = T, se = F)

Hadley

On Fri, Sep 19, 2008 at 12:45 PM, Juliet Hannah <juliet.hannah at gmail.com> wrote:
> How can I reproduce this graph in ggplot2 (regression lines and data
> point superimposed). Thanks, Juliet
>
> filename="http://personality-project.org/r/datasets/heating.txt"
> heating=read.table(filename,header=TRUE)
> symb=c(19,25,3,23)
> colors=c("black","red","green","blue")
> plot(degreedays,therms,pch=symb[Location],col=colors[Location],bg=colors[Location],cex=1.0)
> by(heating,Location,function(x) abline(lm(therms~degreedays,data=x)))
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
http://had.co.nz/