geom_timeline: The geom_timeline function

Description Usage Examples

View source: R/geoms.R

Description

Used in conjunction with GeomTimeline. See the layout contained within the course materials p.g. 452 Here the layout of this function is very similar. This geom looks to chart a timeline of earthquakes for a given country / countries with points (in the example) representing earthquake events, point size indicating earthquake magnitude and colour representing number of deaths. x (the date) is a required aesthetic whereas y (country) is optional.

Usage

1
2
3
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("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)

simongarisch/R-Capstone-NOAA documentation built on May 24, 2019, 7:25 p.m.