An updated version of The Hitchhiker’s Guide to Ggplot2

September 7, 2019
By

[This article was first published on Pachá, 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.

About the book

This book will help you master R plots the easy way, and this update works will recent versions
of R packages. The book can be found at Leanpub.

We have spent a long time creating R plots with different tools (base, lattice and ggplot2) during different academic and working positions. If you want to create highly customised plots in R, including replicating the styles of XKCD, The Economist or FiveThirtyEight, this is your book.

Here’s a part of the steps to create the cover:

library(dplyr)
library(ggplot2)
library(grid)
library(datasauRus)

g <- ggplot() +
  geom_point(
    data = filter(datasaurus_dozen, dataset == "dino"),
    aes(x = x, y = y), color = "#9ccbc7", size = 4
  ) +
  theme_minimal() + 
  theme(
    plot.background = element_rect(fill = "#007d73"),
    axis.line = element_line(color = "#007d73"),
    panel.grid.minor = element_blank(),
    axis.ticks = element_line(color = "#007d73"),
    axis.text = element_text(color = "#9ccbc7",
                             family = "DecimaMonoPro",
                             size = 16),
    axis.title = element_text(color = "#9ccbc7",
                              family = "DecimaMonoPro",
                              size = 24)
  )

print(
  g, 
  vp = viewport(
    angle = 15,
    width = unit(.75, "npc"),
    height = unit(.75, "npc")
  )
)

To leave a comment for the author, please follow the link and comment on their blog: Pachá.

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

Sponsors

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)