geom_timeline: Module 2: Visualization tools: geom_timeline()

Description Usage Arguments Examples

View source: R/visualization tools.R

Description

Building geom_timeline() a geom for ggplot2 for plotting a timeline of earthquakes (xmin to xmax of dates) for each earthquake points (in the example) represent earthquake events, point size indicating earthquake magnitude and colour represent number of deaths. xaes = the date (required), yaes = country (optional)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
geom_timeline(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Arguments

...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
 df <- df %>% filter(COUNTRY %in% c("CHINA", "USA"), YEAR > 2000)
 ggplot(df, aes(x = date, y = COUNTRY,
                color = as.numeric(TOTAL_DEATHS),
                size = as.numeric(EQ_PRIMARY),
                label = CLEAN_LOCATION_NAME)) +
   geom_timeline() +
   labs(size = "Richter scale value", color = "# deaths") +
   ggplot2::theme(panel.background = ggplot2::element_blank(),
         legend.position = "bottom",
         axis.title.y = ggplot2::element_blank()) +
   ggplot2::xlab("DATE")

## End(Not run)

dannyjwpark/NOAA documentation built on Dec. 31, 2020, 11:11 p.m.