inst/examples/datasauRus.R

if (require(ggplot2)) {
  library(ggplot2)
  library(datasauRus)
  ggplot(datasaurus_dozen, aes(x = x, y = y, colour = dataset)) +
    geom_point() +
    theme_void() +
    theme(legend.position = "none") +
    facet_wrap(~ dataset, ncol = 3)
}

# Base R Plots
state = par("mfrow", "mar")

par(mfrow = c(5, 3), mar = c(2, 2, 2, 2))

sets = unique(datasaurus_dozen$dataset)

for (s in sets) {
  df = datasaurus_dozen[datasaurus_dozen$dataset == s, ]
  plot(df$x, df$y, pch = 16)
  title(s)
}

par(state)
stephlocke/datasauRus documentation built on March 2, 2024, 1:45 a.m.