0

for instance when i got this:

https://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!

IRTFM
  • 258,963
  • 21
  • 364
  • 487
Druss2k
  • 275
  • 2
  • 5
  • 15

1 Answers1

8

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 
                           ))

symbols not recycled

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).

Dieter Menne
  • 10,076
  • 44
  • 67
  • hi, you are right i should brought a example. i honsetly thought ive just forgotten to set something up such that this problem wont occur. the best solution (i guess) is to set up one color which will then be recycled for all other outlier as well. thx again! – Druss2k Jun 01 '12 at 17:22