简体   繁体   中英

How to set the color of outlier in R - lattice - bwplot

for instance when i got this:

http://i.stack.imgur.com/cWTIm.jpg

It seems that I've to set the color for every outlier separately...

Here is my (fractional) guess at code:

...,par.settings = list(...,box.rectangle = list(col= c("red","blue")),...) ),...

thx already in advance!

Fair question, but please do not post "fractional guesses at code"; it's unfair to ask other to generate the sample problem.

Here is the sample code, which confirms what you found:

library(lattice)
d = data.frame(x=c(rnorm(90),20*runif(16)),group=letters[1:2])
cols = list(col=c("red","blue"),pch=c(1,16,13))
bwplot(group~x,data=d,  
       par.settings = list(
                           plot.symbol=cols,
                           box.rectangle = cols,
                           box.dot = cols,
                           box.umbrella=cols 
                           ))

不可回收的符号

and here is the code that shows that the outlier pch/col/alpha/cex are not grouped, and therefore are recycled incorrectly.

From panel.bwplot:

panel.points(x = rep(levels.fos, sapply(blist.out, length)), 
             y = unlist(blist.out), pch = plot.symbol$pch, col = plot.symbol$col, 
             alpha = plot.symbol$alpha, cex = plot.symbol$cex, 
             fontfamily = plot.symbol$fontfamily, ......

Which means that this is a missing feature in lattice (I would not call it a bug).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM