Description Usage Arguments Value Examples
View source: R/geom_timeline.R
Construct a regular function/layer to plot a timeline with the earthquakes of a given country that is added to a plot created with ggplot() function.
The geom_timeline()
function is a wrapper to the layer function for the 'GeomTimeline' class.
1 2 3 4 5 6 7 8 9 10 |
mapping |
aesthetic mappings created by aes |
data |
is the data frame that contains the earthquake's data |
stat |
layer's statistical transformation |
position |
position adjustment function |
na.rm |
remove the NA values from the data frame |
show.legend |
layer's legend |
inherit.aes |
will indicate the default aesthetics overridng |
... |
layer's other arguments |
a plot timeline with earthquakes of a given country or list of countries.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
filename <- system.file("extdata", "signif.txt", package = "earthquakes")
library(readr)
eq_data_raw <- readr::read_delim(file = filename, delim = "\t")
eq_data <- eq_clean_data(eq_raw = eq_data_raw)
library(dplyr)
library(ggplot2)
library(ggthemes)
eq_data %>%
dplyr::filter(DATE >= "1995-01-01" &
DATE <= "2018-01-01" &
COUNTRY %in% c("USA","ITALY","MEXICO")) %>%
ggplot(aes(x = DATE,
y = COUNTRY,
colour = DEATHS,
size = EQ_PRIMARY)) +
geom_timeline() +
theme_tufte() +
theme(legend.position = "right")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.