Hi,
I feel that your example isn't exactly minimal so I may be completely
overlooking your question. Would the following do?
library(lattice)
mdf <- data.frame(x <- seq(0, pi, l=100), y=sin(x))
xyplot(y~x, data=mdf, type="b",
par.settings=list(plot.symbol=list(pch=21, col="red",
fill="blue"),
plot.line=list(col="blue")))
baptiste
On 25 Oct 2008, at 15:39, John Poulsen wrote:
> Hello,
>
> I am using xyplot and am happy with my graph, *except* that I cannot
> get
> the symbols to be filled. I tried using
>
bg=c("red3","red","black","lightgrey"))
in both the key and the xyplot
> function, that that was obviously not the answer. I would like the
> sybols to be filled with the same colors as the lines.
>
> Does anybody have an answer? In case you want to see the graph so
> far,
> I have included a ridiculously large dataframe for an example. It
> should work by copying and pasting everything below.
>
> Thanks,
> John
>
>
> ## Data for dataframe
> Per
> =
> c
>
(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
> ,
> 3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4)
>
> Effect=c(NA,NA,NA,
>
0.2376395534,0.2746666667,0.4498834499,0.0070370370,0.0000000000,0.0000000000,0.1510180755
> ,
>
0.1939983165,0.3705749806,0.0003326279,0.0000000000,0.0000000000,0.0607577973,0.3087870370,0.2044472934
> ,NA,NA,
> NA,0.1575877193,0.3622888889,0.3349059829,NA,NA,NA,
> 0.1529505582,0.2393737374,0.3928671329,
>
0.0036094276,0.0000000000,0.0000000000,0.0798121567,0.1404797980,0.3064283864,0.0016199430,0.0000000000,0.0000000000,0.0334615010
> ,
> 0.2346388889,0.1558945869,NA,NA,NA,
> 0.1445175439,0.3089333333,0.2867008547,NA,NA,
> NA,
>
0.1410287081,0.2057979798,0.3950738151,0.0000000000,0.3050398860,0.0862091150,0.0673657629,0.1273569024,0.3064128464
> ,
>
0.0109369149,0.3582849003,0.0224585137,0.0322641326,0.2232962963,0.1731766382
> ,NA,NA,NA,0.1255701754,
> 0.2923111111,0.2842905983,NA,NA,NA,
> 0.1369736842,0.1703777778,0.3386666667,0.0042262922,0.3632792023,
>
0.1664267677,0.0594074074,0.1016666667,0.2522079772,0.0000000000,0.4042621083,0.0241041366,0.0275009747,0.1971481481,0.1156780627
> ,
> NA,NA,NA,0.1309649123,0.2715333333,0.2804786325)
>
> Spp
> =
> c
> ("BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
>
","TIA","BOM","ING","Mal","MGZ","NGA","TIA","BOM","ING","Mal","MGZ",
> "NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
>
","MGZ","NGA","TIA","BOM","ING","Mal","MGZ","NGA","TIA","BOM","ING",
> "Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
> ","ING
> ","Mal
> ","MGZ
> ","NGA
> ","TIA
> ","BOM
>
","ING","Mal","MGZ","NGA","TIA","BOM","ING","Mal","MGZ","NGA","TIA")
>
> Treat
> =
> c
> ("CL
> ","CL
> ","CL
> ","CL
> ","CL
> ","CL
> ","UL
> ","UL
> ","UL
> ","UL
> ","UL
> ","UL
> ","UU
> ","UU
> ","UU
> ","UU
> ","UU
> ","UU
> ","CU
> ","CU
> ","CU
> ","CU
> ","CU
> ","CU
> ","CL
> ","CL
> ","CL
> ","CL
> ","CL
> ","CL
> ","UL
> ","UL
>
","UL","UL","UL","UL","UU","UU","UU","UU","UU","UU","CU","CU","CU",
> "CU
> ","CU
> ","CU
> ","CL
> ","CL
> ","CL
> ","CL
> ","CL
> ","CL
> ","UL
> ","UL
> ","UL
> ","UL
> ","UL
> ","UL
> ","UU
> ","UU
> ","UU
> ","UU
> ","UU
> ","UU
> ","CU
> ","CU
> ","CU
> ","CU
> ","CU
> ","CU
> ","CL
> ","CL
> ","CL
> ","CL
> ","CL
>
","CL","UL","UL","UL","UL","UL","UL","UU","UU","UU","UU","UU","UU",
>
"CU","CU","CU","CU","CU","CU")
>
>
splabel=c("A","B","C","D","E","F")
>
> resmat=data.frame(Effect, Per, Spp, Treat)
>
> ## Graphing functions
> library(lattice)
>
> key.aug <- list(corner=c(0,0.93), text = list(levels(resmat$Treat)),
> points = list(pch = c(21,2,21,2), cex=c(1.2,1,1.2,1), col >
c("red3","red","black","lightgrey")),
lwd=2, cex=0.8)
>
> xyplot(Effect~Per|Spp, resmat, groups=Treat, type="b", lwd=2,
> pch=c(21,2,21,2), cex=c(1.2,1,1.2,1),
>
col=c("red3","red","black","lightgrey"),xlab=c("Months"),
> strip=strip.custom(style=1, bg="lightgrey",
> factor.levels=c(splabel)),
> ylab=expression(Treatment-Control/Augmentation),
> par.strip.text=list(cex=1, lines=1.25, lwd=2),
> scales=list(x=list(at=c(1,2,3,4), labels=c(3,6,9,12)),
> y=list(ylim=list(c(0,1),c(0,1),c(0,1),
> c(0,1),c(0,1),c(0,1)))),
> key=key.aug)
>
> ______________________________________________
> R-help at 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.
_____________________________
Baptiste Augui?
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag