Barplot





Welcome to the barplot section of the R graph gallery. A barplot is used to display the relationship between a numeric and a categorical variable. This section also include stacked barplot and grouped barplot where two levels of grouping are shown.

Step by step - ggplot2 and geom_bar()

ggplot2 allows to build barplot thanks to the geom_bar() function. The examples below will guide you through the basics of this tool:



Base R and the barplot() function

Basic R can build quality barplots thanks to the barplot() function. Here is a list of examples guiding you through the most common customization you will need.

🌐 From the web

The web is full of astonishing R charts made by awesome bloggers. The R graph gallery tries to display some of the best creations and explain how their source code works. If you want to display your work here, please drop me a word or even better, submit a Pull Request!

Related chart types


Barplot
Spider / Radar
Wordcloud
Parallel
Lollipop
Circular Barplot