Hello

I want to draw a plot and classify the dot by different color, according to
the habitats.
I am using xyplot in lattice but do not know how to assign specific colors
to the habitats.
Please kindly advise how to modify the code.

Thank you.

Elaine


code
    dataN <-read.csv("H:/Mig_bird_586_20130109.csv",header=T, row.names=1)
    dataN$Habitat <-factor(dataN$Habitat)
    dim(dataN)
    dataN[1,]

    habitat.code <- c("Water", "Land")
    habitat.colors <- c("darkblue","forestgreen")
    levels(dataN$Habitat) <- habitat.code

  # graph
    par(mai=c(1.03,1.03,0.4,0.4))
    par(new=T)

    xyplot(GE_distance~Habitat, data=dataN,
    xlab=list("Habitat", cex = 1.4),
    ylab=list("Migration  Distance  (km)",cex = 1.4),
    cex=1.5)

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to