Easy ggplot2 Theme customization with {ggeasy}

April 21, 2020

[This article was first published on r-bloggers on Programming with R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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



# generate dataset

clients <- fakir::fake_ticket_client(100)

# rotate x axis labels

clients %>% 
  count(state) %>% 
  ggplot() + geom_col(aes(state,n)) +

# 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")

To leave a comment for the author, please follow the link and comment on their blog: r-bloggers on Programming with R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)