Skip to content
Prev 270413 / 398502 Next

Scatter Plot Command Syntax Using Data.Frame Source

Hi,

Below are a couple of options using a standard dataset,

str(iris)

## using base graphics
d <- split(iris, iris$Species)
str(d) # list of 3 data.frames

par(mfrow=n2mfrow(length(d))) # split the device in 3 plotting regions
b.quiet <- lapply(names(d), function(x) { # loop over the list names
  with(d[[x]], plot(Sepal.Length, Petal.Length))
  title(x)
})

library(ggplot2)
# using facetting
ggplot(iris) + facet_wrap(~Species) +
  geom_point(aes(Sepal.Length, Petal.Length))

library(lattice)
# using facetting
xyplot(Petal.Length ~ Sepal.Length | Species, data=iris )

HTH,

baptiste
On 1 September 2011 08:50, Rich Shepard <rshepard at appl-ecosys.com> wrote:
Message-ID: <CANLFJPrnKJawR9AywXV3DFYKecLaAv10TON8eV9h=RkPpwOPpQ@mail.gmail.com>
In-Reply-To: <alpine.LNX.2.00.1108311339290.22260@salmo.appl-ecosys.com>