[R] filled circle with a black line on the rim in pch function

Christine Lee leptostracan at yahoo.com
Tue Dec 1 07:20:44 CET 2015


Dear All,

I have an embarssing question, I want to put a black line as a rim on the grey symbol in the xyplot, to no avail.
.  I thought it was easy, by changing the pch code from 16 to 21.  I was surpised that I ran into difficulty.
  
My original script is as follows:
library(lattice)
xyplot(Abun~Date1|Station, data=Raw,
        groups = culr,
        par.settings = list(strip.background = list(col = "transparent"),
                            superpose.symbol = list(cex = rep(2, 2),
                                                    col=c("grey","black"),
                                                    pch = rep(16,2))),
        type="p",
        xlab=list("Month",cex=1.5),
        ylab=list("Abundance",cex=1.5),  
        index.cond=list(c(1,2,3,4)),
        auto.key = T,
        layout=c(4,1))


I have changed pch number into 21, the symbols did show a black rim, but the filled circle colours became blue and pink, instead of the designated grey and black.  This puzzles me.  

My data is as follows:
Raw<-structure(list(Date = structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L, 
2L, 4L, 12L, 6L, 15L, 14L, 3L, 6L, 1L, 16L, 5L, 11L, 8L, 4L, 
10L, 13L, 6L, 1L, 16L, 5L, 11L, 8L, 4L, 10L, 13L, 6L, 1L, 16L, 
5L, 11L, 8L, 4L, 10L, 13L, 11L, 8L, 4L, 10L, 13L), .Label = c("1/10", 
"1/11", "11/11", "12/11", "13/10", "19/9", "2/10", "2/11", "20/9", 
"26/11", "29/10", "29/11", "30/11", "31/10", "4/10", "6/10"), class = "factor"), 
    Year = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Y2002", "Y2014"), class = "factor"), 
    Station = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 4L, 4L, 4L, 4L, 4L), .Label = c("E", "F", "H", "I"
    ), class = "factor"), Abun = c(3.42, 1.33, 3.67, 3.67, 3.92, 
    2.17, 2.5, 1.67, 6.33, 0.67, 1, 1, 1.33, 2.08, 0, 0, 0.33, 
    0.08, 0.08, 0, 0.5, 0.17, 0.67, 0.67, 0, 1, 0.58, 1.5, 2.67, 
    0.67, 1.33, 3, 0.58, 1.17, 1.25, 0.75, 1.25, 1.75, 0.92, 
    1.5, 0.83, 0.75, 2.33, 0.67, 1.33, 1.58), Date1 = structure(c(16697, 
    16710, 16740, 16751, 16768, 16698, 16710, 16740, 16751, 16768, 
    16697, 16712, 16739, 16750, 16697, 16709, 16714, 16721, 16737, 
    16741, 16751, 16765, 16769, 16697, 16709, 16714, 16721, 16737, 
    16741, 16751, 16765, 16769, 16697, 16709, 16714, 16721, 16737, 
    16741, 16751, 16765, 16769, 16737, 16741, 16751, 16765, 16769
    ), class = "Date")), .Names = c("Date", "Year", "Station", 
"Abun", "Date1"), row.names = c(NA, -46L), class = "data.frame")

Can any one help me please?

With best regards,
Christine



More information about the R-help mailing list