Load neccessary packages and data

library("ggplot2")
library("tidyverse")
## -- Attaching packages -------------------------------------------------------------------- tidyverse 1.2.1 --
## v tibble  1.4.2     v purrr   0.2.5
## v tidyr   0.8.2     v dplyr   0.7.8
## v readr   1.1.1     v stringr 1.3.1
## v tibble  1.4.2     v forcats 0.3.0
## -- Conflicts ----------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
data("mtcars")

Basic barplot

Note cyl is coerced to a factor as it is a series of integers.

p <- ggplot(mtcars, aes(factor(cyl)))
p + geom_bar()

The bars of the barplots can be adjusted by width, outline colour and fill like so:

p + geom_bar(width = 0.6, colour = "blue", fill="white")

Themes can be applied to provide various different “looks”.

Classic:

p + geom_bar() + theme_classic()

Minimal:

p + geom_bar() + theme_minimal()

Black and white:

p + geom_bar() + theme_bw()