Before drawing a grouped barplot, you need to know how to draw a basic barplot with ggplot2. Then, the method is almost the same, except you add a “fill” argument in the aestetic, which cut your bar following the levels of a discrete variable. Bars can be one beside each other (“Grouped barplot“), one on top of each other (“Stacked barplot“) and showing percentage of each level (“Percent stacked barplot“).

It is easy to custom colors as described in the basic barplot section. Note that using faceting can be a good alternative to grouped barchart that are hard to read when to many groups.

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



Leave a Reply

Notify of