Description Usage Arguments See Also Examples
The geom_timeline
displays the timeline of the observations along
with each point observed during the given period.
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. |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
na.rm |
If 'FALSE', the default, missing values are removed with a warning. If 'TRUE', missing values are silently removed. |
... |
other arguments passed on to the layer function. These are often aesthetics, used to set an aesthetic to a fixed value, like 'color = "red"' or 'size = 3'. They may also be parameters to the paired geom/stat. |
geom_timeline_label
to include labels for each
observation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | require(dplyr)
require(ggplot2)
# Before using the geom, we need to tidy the data up.
raw_data <- get_earthquake_data()
clean_data <- eq_clean_data(raw_data)
# Quakes in USA
clean_data %>%
filter(COUNTRY == "USA",
!is.na(EQ_PRIMARY),
YEAR %in% 2000:2016) %>%
ggplot(mapping = aes(x = DATE,
size = EQ_PRIMARY,
color = TOTAL_DEATHS)
) +
geom_timeline() +
labs(size = "Richter scale value",
color = "# deaths",
y = "") +
theme_timeline()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.