On Wed, Oct 10, 2012 at 4:56 AM, Pierrick Bruneau <pbruneau@gmail.com>wrote:

> With the following code :
>
> dat1 <- matrix(nrow=4, ncol=2)
> dat1[1,] <- c(-2, 1)
> dat1[2,] <- c(-1.7, 0.9)
> dat1[3,] <- c(0.1, 0.6)
> dat1[4,] <- c(0.5, 0.5)
> theplot <- xyplot(V2 ~ V1, as.data.frame(dat1), pch=c(4,1,5,4))
> plot(theplot, prefix="theplot") # for a predictable name
> grid.edit("theplot.xyplot.points.panel.1.1", gp=gpar(lwd=c(2,2,2,2),
> cex=c(2,3,3,2),
>   col=1, fill=c("transparent", "grey", "grey", "transparent")))
>
>
> I would like to plot 4 points, and have the circle and diamond shapes
> filledwith grey. What am I missing ?
>
> The correct pch+col (fill is for polygons) specification. Try

theplot <- xyplot(V2 ~ V1, as.data.frame(dat1), pch = c(4,19,18,4) , col =
c(1,'grey35','grey65',1) )
plot(theplot, prefix="theplot") # for a predictable name
grid.edit("theplot.xyplot.points.panel.1.1", gp = gpar( lwd = c(2,2,2,2) ,
cex = c(2,3,3,2) ) )

BTW in R you don't need to declare objects, i.e.

dat1 <- matrix(c(-2,-1.7,0.1,0.5,1,.9,.6,.5), nrow=4, ncol=2)

works just as well (or IMHO better).
Similarly, your plot can be generated in one "go", no need to plot => edit,
just put in the right args to begin with.

HTH




Thanks by advance for your help,
> Pierrick Bruneau
> Research Fellow
> CRP Gabriel Lippmann
>
>         [[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.
>

	[[alternative HTML version deleted]]


