ggplot2

ggplot2 extensions - gallery

Programming

Plot Anything with ggplot2

Extending your ability to extend ggplot2 - Thomas Lin Pedersen

Extensions

Blogs

Creating corporate colour palettes for ggplot2

Wrapping around ggplot2 with ggperiodic

Custom Discrete Color Scales for ggplot2

Making a background color gradient in ggplot2

Changing Glyph in legend in ggplot2

Practical ggplot2

R you ready to make charts?

REORDERING AND FACETTING FOR GGPLOT2

Examples of ggplot2

Top 50 ggplot2 Visualizations - The Master List (With Full R Code)

Plots together as subplots

Subplots in maps with ggplot2 • Ilya Kashnitsky

Embedding subplots in ggplot2 graphics

Raster images into plot

Dr. Mowinckel’s Adding external images to plots

Tricolor legend

GitHub - jschoeley/tricolore: A flexible color scale for ternary compositions

Multiple color of fill scales

A way to add multiple color or fill scales to a ggplot2 plot · GitHub

BBC cookbook

BBC Visual and Data Journalism cookbook for R graphics

gganimate

GitHub - thomasp85/gganimate: A Grammar of Animated Graphics

Bar-Chart-Race

Bar chart animation

Examples

Lables

devtools::install_github("AliciaSchep/gglabeller") 

library(gglabeller)
library(ggplot2)
library(ggrepel)

data("mtcars")

p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + 
            theme_classic(base_size = 18)

gglabeller_example <- gglabeller(p, aes(label = rownames(mtcars)))

metR

devtools::install_github("eliocamp/metR")

geom_contour_fill()
geom_streamline()

ggnewscale

library(ggplot2)
library(ggnewscale)
# Equivalent to melt(volcano)
topography <- expand.grid(x = 1:nrow(volcano),
                          y = 1:ncol(volcano))
topography$z <- c(volcano)

# point measurements of something at a few locations
set.seed(42)
measurements <- data.frame(x = runif(30, 1, 80),
                           y = runif(30, 1, 60),
                           thing = rnorm(30))

ggplot(mapping = aes(x, y)) +
  geom_contour(data = topography, aes(z = z, color = stat(level))) +
  # Color scale for topography
  scale_color_viridis_c(option = "D") +
  # geoms below will use another color scale
  new_scale_color() +
  geom_point(data = measurements, size = 3, aes(color = thing)) +
  # Color scale applied to geoms added after new_scale_color()
  scale_color_viridis_c(option = "A")

xkdc

devtools::install_github("dreamRs/wired")

library(xkcd)
library(wired)

h <- ggplot(d()) + geom_histogram(aes(x))
h <- h + scale_x_log10()
ggplot() + 
      xkcdrect(
        mapping = aes(
          xmin = xmin,
          xmax = xmax,
          ymin = 0,
          ymax = count
        ),
        data = layer_data(h),
        fill = "steelblue", colour = "black"
      ) + 
      theme_minimal()

lares

Timetable

devtools::install_github("laresbernardo/lares")

library(lares)

order <- c("Role", "Place", "Type", "Start", "End")
today <- as.character(Sys.Date())
cv <- data.frame(rbind(
  c("Head of Data Science and Analytics", "Comparamejor", "Work Experience", "2016-08-01", today),
  c("Data Scientist Consultant", "MatrixDS", "Work Experience", "2018-09-01", today),
  c("Big Data & Data Science Programme", "UdC", "Academic", "2017-09-01", "2018-02-28"),
  c("Project Engineer", "Polytex", "Work Experience", "2016-05-15", "2016-09-01"),
  c("Big Data Analyst", "MEG", "Work Experience", "2016-01-01", "2016-04-30"),
  c("Advanced Excel Instructor", "ARTS", "Work Experience", "2015-11-01", "2016-04-30"),
  c("Continuous Improvement Intern", "PAVCO", "Work Experience", "2015-04-01", "2015-08-30"),
  c("Mechanical Design Intern", "SIGALCA", "Work Experience", "2013-07-01", "2013-09-30"),
  c("DJs Online Community Owner", "LaresDJ.com -> SoloParaDJs", "Extra", "2010-01-05", today),
  c("Mechanical Engineer Degree", "USB", "Academic", "2009-09-15", "2015-11-20"),
  c("DJ and Composer/Producer", "Legacy Discplay", "Extra", "2009-05-01", "2015-04-30")
))
colnames(cv) <- order

plot_timeline(event = cv$Role, 
              start = cv$Start, 
              end = cv$End, 
              label = cv$Place, 
              group = cv$Type,
              save = FALSE)