knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

ggDarwin

The goal of ggDarwin is to ...

Installation

You can install the development version of ggDarwin like so:

install.packages("remotes")
remotes::install_github("edward-burn/ggDarwin")

Example

Before ggDarwin

library(ggDarwin)
library(dplyr)
library(ggplot2)
library(lubridate)

Sys.setlocale("LC_TIME", "English")

# Example 1-----

# Plot
y.var <- economics$uempmed
y.name <- "Unemployment"
economics %>%
  ggplot()+
  geom_point(aes(date,y=y.var))+
  geom_line(aes(date,y=y.var), size=0.8)+
  scale_y_continuous(name= y.name)+
  xlab("")

And now with ggDarwin

time <- "year" # Time units (day, month, week or year)
interval <- 5  # Interval between x-axis breaks
start <- min(economics$date) # Start date
end <- max(economics$date) # End date

economics %>%
  ggplot()+
  geom_point(aes(date,y=y.var))+
  geom_line(aes(date,y=y.var), size=0.8)+
  scale_y_continuous(name= y.name)+
  xlab("")+
  scale_x_date_darwin(time,start,end, interval)+
  theme_darwin()


edward-burn/ggDarwin documentation built on May 14, 2022, 4:50 p.m.