R ggplot themes

Nic Coxen
3 min readJan 24, 2023

theme_bw() , theme_minimal(), theme_classic() …

Photo by Sigmund on Unsplash

What are ggplot themes?

In R , ggplot2 is a popular data visualization library which can create static and interactive plots. A key features of ggplot2 is the ability to customize the look and feel of a plot through themes.

A theme in ggplot2 is a set of pre-defined options that control the visual elements of a plot, such as the font size, axis labels, and background color. There are several built-in themes available in ggplot2, such as theme_gray(), theme_classic(), and theme_bw(), and more …

Setting the themes

Themes can be applied to a plot using the + operator , or they can be set prior to building the plot as shown below,

theme_set(theme_bw())

another way of setting a theme is attaching it to the plot with the + operator:

p <- CarSalesData %>% ggplot()+
geom_point(mapping = aes(x = Vehicle.Age.Yrs , y = Mileage , col = Vehicle.Type )) +
labs(title = "Theme_minimal")

p + theme_minimal()theme_minimal()

--

--

Nic Coxen

I'm interested in data analytics with Python, SQL , R and Julia, I create R Shiny and and Python tkinter apps, and recently created a YouTube downloader app!