Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the boundary color of boxplot?

Tags:

r

boxplot

I'd like to create boxplot like this:enter image description here

This plot is created by bwplot in lattice package. Instead using this function, I hope to use boxplot to plot similar thing.

I notice in boxplot we could only change the color of the box body, how could I change the boundary color of the box by boxplot function? Thanks!

like image 957
Xiaochuan Zhang Avatar asked Aug 02 '12 19:08

Xiaochuan Zhang


1 Answers

Look at ?boxplot to find that there's an argument border= that does what you want. For example:

boxplot(count ~ spray, data = InsectSprays, col = "lightgray",
        border=c("blue", "green", "blue", "green", "blue", "green"))

enter image description here

like image 191
Josh O'Brien Avatar answered Sep 22 '22 04:09

Josh O'Brien