Hello

I want to draw a xyplot.
Its dots will have three colors: red for meat, green for vegetable, and
blue for both.

I used the code below but could not make the dot in the same group show the
same color.
Please kindly advise how to modify it.
Thank you.

code

library (lattice)
 diet.code <- c("Herbivore", "Omnivore", "Carnivore")
    Diet.colors <- c("forestgreen", "darkblue","red2")
    levels(dataN$Diet) <- diet.code

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

    xyplot(GE_distance~Diet, data=dataN,
    xlab=list("Diet  of  Breeding  Ground", cex = 1.4),
    ylab=list("Migration  Distance",cex = 1.4),
    xaxt="n",
    yaxt="n",type="p",
    lwd=1.5,
    cex.lab=1.4, cex.axis=1.2,
    font.axis=2,
    cex=1.5,
    las=1,
    bty="l",
    col=rep(Diet.colors))

        [[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