Share the Gallery !Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone



Boxplot is an R function that represents a numeric vector of data that is split in several groups.

It can be usefull to add colors to specific groups to highlight them. For exemple, positiv and negativ control are likely to be in different colors.

The easiest way is to give a vector of colors when you call the boxplot function (as described in this post). However, you will have to adjust this vector if you add or remove a group.

Using the ifelse function as below will permit to easily add the color you want to a specific name, which is much more convenient !

Not really what you are looking for ? Make a new search !


Leave a Reply

Be the First to Comment!

Notify of