1

I'm trying to do this example, but I am not getting the same result. The outlier points are still black.

Here is the example I tried to replicate:

m <- ggplot(movies, aes(y = votes, x = factor(round(rating)),
    colour = factor(Animation)))
m + geom_boxplot(outlier.colour = NULL) + scale_y_log10()

Below is the output from sessionInfo(), note that I'm using R version 3.1.2, and ggplot2 version 1.0.0.

sessionInfo() R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] xtable_1.7-4    mvabund_3.9.3   Rcpp_0.11.3     ggplot2_1.0.0   stringr_0.6.2  
 [6] vegan_2.2-1     lattice_0.20-29 permute_0.8-3   reshape2_1.4.1  dplyr_0.4.1    

loaded via a namespace (and not attached):
 [1] assertthat_0.1   cluster_1.15.3   colorspace_1.2-4 DBI_0.3.1        digest_0.6.8    
 [6] grid_3.1.2       gtable_0.1.2     labeling_0.3     lazyeval_0.1.10  magrittr_1.5    
[11] MASS_7.3-35      Matrix_1.1-5     mgcv_1.8-4       munsell_0.4.2    nlme_3.1-119    
[16] parallel_3.1.2   plyr_1.8.1       proto_0.3-10     scales_0.2.4     statmod_1.4.20  
[21] tools_3.1.2      tweedie_2.2.1   
Community
  • 1
  • 1
user3389288
  • 992
  • 9
  • 30

1 Answers1

0

Sorry misunderstood your intent.

Edit: Then I think the accepted answer from your link works. Reproduced below using dplyr

library(dplyr)
plot_Data <- mtcars %>% group_by(cyl) %>% 
                        mutate(Q1=quantile(mpg, 1/4),
                               Q3 = quantile(mpg, 3/4), 
                               IQR = Q3-Q1, upper.limit = Q3+1.5*IQR,  
                               lower.limitit=Q1-1.5*IQR) 

 ggplot() +
          geom_boxplot(data=plot_Data, aes(x=factor(cyl), y=mpg, col=factor(cyl))) + 
          geom_point(data=plot_Data[plot_Data$mpg > plot_Data$upper.limit | plot_Data$mpg < plot_Data$lower.limit,], aes(x=factor(cyl), y=mpg, col=factor(cyl)))
jraab
  • 413
  • 4
  • 10
  • When I tried that out, it appeared to remove the outliers. I want to keep the outliers but change the colour to the same as that of the respective boxplots. – user3389288 Jan 21 '15 at 15:54
  • I'm wondering specifically if the accepted answer in the updated link will work? To try and use the outlier.colour argument to the geom_boxplot function. – user3389288 Jan 21 '15 at 18:40
  • I don't believe so - it looks like with older versions of ggplot2 it would, but now you seem to have to calculate outlier points separately. – jraab Jan 21 '15 at 19:07
  • The accepted answer of [this](http://stackoverflow.com/questions/15273148/coloring-boxplot-outlier-points-in-ggplot2?rq=1) question is where I got my code above. – jraab Jan 21 '15 at 19:08