geom_timeline: geom_timeline function

Description Usage Examples

View source: R/geom_timelines.R

Description

This geom charts a timeline of earthquakes for a given country with points along the timeline for each earthquake. The size of the point inicates the magnitude of the earthquake, while the color indicates the number of deaths. The date (x) is a required aesthetic. The country (y) is 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,
  ...
)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
 df <- df_earthquakes %>% filter(COUNTRY %in% c("GREECE", "USA"), YEAR > 2002)
 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)

lakrobinson/noaar2 documentation built on Dec. 1, 2020, 9:35 p.m.