[R] dotplot

li li hannah.hlx at gmail.com
Sat May 16 21:32:39 CEST 2015


Hi all,
  I wrote the following code and have two questions:
  (1) As you can see, I would like different colors for different
types. It does not come out that way in the graph from this code.
Anyone know how to fix this?
   (2) How do I made the lots number on x axis eligible to read?
   (3) How do I remove the verticle line in the graph.
    Thanks for your help.
      Hanna


lot <- as.character(c("D1300000" ,"D1300005" ,"D1300010", "D1300015",
"D1300020",
         "D1300025" ,"D1300030" ,"D1300035", "D1300040",  "D1300045",
         "D1300000" ,"D1300005" ,"D1300010", "D1300015",  "D1300020",
         "D1300025" ,"D1300030" ,"D1300035", "D1300040",  "D1300045",
         "D1300000" ,"D1300005" ,"D1300010", "D1300015",  "D1300020",
         "D1300025" ,"D1300030" ,"D1300035", "D1300040",  "D1300045"))

val <- rnorm(30)
type <- rep(1:3,each=10)
tmp <- as.data.frame(cbind(val, type, lot))
tmp$sybm <- rep(c(1, 12, 16), each=10)
tmp$color <- rep(c("blue", "red", "green"), each=10)
tmp$val <- as.numeric(tmp$val)
dotplot(val ~ lot, tmp,
        ylab = "values", xlab="lot", aspect=1,
        pch=tmp$sybm, color=tmp$color)



More information about the R-help mailing list