An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100927/e54b6049/attachment.pl>
bwplot superpose panel.points from another dataframe
6 messages · Peter Ehlers, Dennis Murphy, Deepayan Sarkar +1 more
On 2010-09-27 4:54, Christophe Bouffioux wrote:
bwplot(v2 ~ v1 | z, data = ex3, layout=c(3,2),
pch = "|",
par.settings = list(
plot.symbol = list(alpha = 1, col = "transparent",cex = 1,pch = 20)),
panel = function(x, y){
panel.bwplot(x, y)
X<- tapply(ex3$v1b, ex3[,c(1,2)], max)
Y<- seq(length(unique(ex3[,c(1,2)])))
panel.points(X, Y, pch = 17, col = "red")
})
Perhaps this is what you're trying to achieve:
bwplot(v2 ~ v1 | z, data = ex3, layout=c(3,2),
panel = function(x, y){
panel.bwplot(x, y, pch="|")
X <- tapply(ex3$v1b, ex3[, 1:2], max)
Y <- seq(nrow(unique(ex3[, 1:2])))
panel.points(X, Y, pch = 17, col = "red")
})
(I didn't see any need for your par.settings.)
I'm not crazy about the way you define X,Y. I think
I would augment the data frame appropriately instead.
-Peter Ehlers
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100928/9375e279/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100928/c823e44a/attachment.pl>
On Tue, Sep 28, 2010 at 12:59 PM, Christophe Bouffioux
<christophe.b00 at gmail.com> wrote:
Thanks for your help Peter but the red marks on boxplot do not correspond to ex2 dataframe actually, it reproduce on each panel the same marks that is to say the 3 first lines of ex2 So this is not correct
You are probably looking for something like these:
bwplot(v2 ~ v1 | z, data = ex3, layout=c(3,2), X = ex3$v1b,
pch = "|",
panel = function(x, y, ..., X, subscripts){
panel.bwplot(x, y, ..., subscripts = subscripts)
X <- X[subscripts]
X <- tapply(X, y, unique)
Y <- tapply(y, y, unique)
panel.points(X, Y, pch = 17, col = "red")
})
bwplot(v2 ~ v1 | z, data = ex, layout=c(3,2), ext.data = ex2,
pch = "|",
panel = function(x, y, ..., ext.data){
panel.bwplot(x, y, ...)
i <- which.packet()
sub <- subset(ext.data, as.numeric(z) == i)
with(sub, panel.points(v1b, v2, pch = 17, col = "red"))
})
-Deepayan
Christophe On Mon, Sep 27, 2010 at 6:18 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
On 2010-09-27 4:54, Christophe Bouffioux wrote:
bwplot(v2 ~ v1 | z, data = ex3, layout=c(3,2),
? ? ? ?pch = "|",
? ? ? ?par.settings = list(
? ? ? ?plot.symbol = list(alpha = 1, col = "transparent",cex = 1,pch =
20)),
? ? ? ?panel = function(x, y){
? ? ? ? ? ? panel.bwplot(x, y)
? ? ? ? ? ? X<- tapply(ex3$v1b, ex3[,c(1,2)], max)
? ? ? ? ? ? Y<- seq(length(unique(ex3[,c(1,2)])))
? ? ? ? ? ? panel.points(X, Y, pch = 17, col = "red")
? ? ? ? ? ? })
Perhaps this is what you're trying to achieve:
?bwplot(v2 ~ v1 | z, data = ex3, layout=c(3,2),
? ? ? panel = function(x, y){
? ? ? ? ? ?panel.bwplot(x, y, pch="|")
? ? ? ? ? ?X <- tapply(ex3$v1b, ex3[, 1:2], max)
? ? ? ? ? ?Y <- seq(nrow(unique(ex3[, 1:2])))
? ? ? ? ? ?panel.points(X, Y, pch = 17, col = "red")
? ? ? ? ? ?})
(I didn't see any need for your par.settings.)
I'm not crazy about the way you define X,Y. I think
I would augment the data frame appropriately instead.
?-Peter Ehlers
? ? ? ?[[alternative HTML version deleted]]
______________________________________________ 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100928/6e179da9/attachment.pl>