[R] An empty grey diagram

Stephen Liu satimis at yahoo.com
Sat Nov 20 06:50:09 CET 2010


ToothGrowth
attach(ToothGrowth)
abline(lm(len ~ does, data = ToothGrowth))

an empty gray graph displayed

continue
plot.new()

the background changes to white colour, still an empty graph

B.R.
satimis





----- Original Message ----
From: Joshua Wiley <jwiley.psych at gmail.com>
To: Stephen Liu <satimis at yahoo.com>
Cc: r-help at r-project.org
Sent: Sat, November 20, 2010 1:39:45 PM
Subject: Re: [R] An empty grey diagram

On Fri, Nov 19, 2010 at 9:35 PM, Stephen Liu <satimis at yahoo.com> wrote:
> Hi David,
>
>
>> What happens when you follow the directions... i.e. type:
>> plot.new()    #???
>
> abline(lm(len ~ dose, data = ToothGrowth))
> plot.new()
>
> The grey background changes to white, still an empty graph

You cannot just use abline() on an empty graphic (well, you can but
you get an empty graph).  Please actually run my code, it will create
a scatter plot, then add a line.  Do not close the graphic device in
between.

with(ToothGrowth, plot(dose, len))
abline(lm(len ~ dose, data = ToothGrowth))






More information about the R-help mailing list