In this post, We’ll learn about {ggeasy} an R package by Jonathan Carroll. The goal of {ggeasy} is to help R programmers make ggplot2 theme customizations with simple-easy English functions. (much easier than playing with theme()
) We use dataset generated by {fakir} for this tutorial.
Youtube: https://youtu.be/iAH1GJoBZmI
Video Tutorial
Code
library(fakir)
library(tidyverse)
library(ggeasy)
# generate dataset
clients <- fakir::fake_ticket_client(100)
# rotate x axis labels
clients %>%
count(state) %>%
ggplot() + geom_col(aes(state,n)) +
easy_rotate_x_labels()
# color the text and increase text size
clients %>%
count(state) %>%
ggplot() + geom_col(aes(n,state), fill = "orange") +
easy_text_color("orange") +
easy_text_size(25, teach = TRUE)
# move legend position
clients %>%
count(state, source_call) %>%# View()
ggplot() + geom_col(aes(n,state, fill = source_call)) +
#easy_move_legend("bottom", teach = TRUE)
theme(legend.position = "bottom")
50%+ R & Python Data Science Course DataCamp Offer*
- Affiliate Link