Description Usage Arguments Value Aesthetics Examples
View source: R/geom_functions.R
The function geom_timeline
plots a timeline geom showing one or
multiple timelines of earthquakes.
1 2 3 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm |
Boolean indicating wheather to remove NA values. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Additional optional parameters. |
The function geom_timeline
plots a timeline geom.
x
: The column of the given data frame depicting the x values of the
timeline geom, usually date.
y
: Optional. The column of the given data frame depicting the y
values of the timeline geom, usually location.
size
: Optional. The column of the given data frame depicting the size
of each point in the timeline geom.
colour
: Optional. The column of the given data frame depicting the
color of each point in the timeline geom.
fill
: Optional. A color string depicting the default fill of each
point in the timeline geom.
shape
: Optional. The column of the given data frame depicting the
shape of each point in the timeline geom.
alpha
: Optional. The column of the given data frame depicting the
alpha value of each point in the timeline geom.
stroke
: Optional. The stroke of the image.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # import libraries
library(dplyr)
library(readr)
# set working directory
setwd(system.file("extdata", package = "noaa"))
# read and clean NOAA data
data <- read_delim("signif.txt", "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY %in% c("USA", "CHINA"), YEAR > 2000)
# plot NOAA data
ggplot2::ggplot(data, ggplot2::aes(DATE,
colour = as.numeric(TOTAL_DEATHS),
y = COUNTRY,
size = as.numeric(EQ_PRIMARY))) +
geom_timeline() +
ggplot2::guides(size = ggplot2::guide_legend(title = "Richter Scale")) +
ggplot2::scale_colour_continuous(name = "Number of Deaths") +
ggplot2::theme_classic()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.