Easy ggplot2 Theme customization with {ggeasy}
[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.
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
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
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.