Xiaochuan Zhang
Xiaochuan Zhang

Reputation: 205

How to change the boundary color of 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!

Upvotes: 8

Views: 29834

Answers (1)

Josh O'Brien
Josh O'Brien

Reputation: 162321

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

Upvotes: 14

Related Questions