Description Usage Arguments Value Examples
View source: R/geom_timeline_label.R
This function plots a timeline of earthquakes and annotates them
1 2 3 4 5 6 7 8 9 10 |
mapping |
Set of aethetics created by aes |
data |
A filtered data frame |
stat |
A string of statistical transformation |
position |
A string of position adjustment |
na.rm |
logical; if FALSE (default) NA values are not removed |
show.legend |
logical; for showing a legend |
inherit.aes |
logical; if TRUE (default) default aesthetics are overridden |
... |
Other arguments including x for the column name for DATE, xmin for the beginning date and xmax for the end date of the timeline |
geom_timeline_label returns a layer for ploting the GeomTimelineLabel object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
Countries <- c('USA', 'CHINA')
XMin <- ymd('2000-01-01')
XMax <- ymd('2020-01-01')
readr::read_delim(system.file("extdata", "signif.txt", package = "TheCapstoneProject"), delim = '\t') %>%
eq_clean_data() %>%
eq_location_clean() %>%
dplyr::filter(COUNTRY %in% Countries) %>%
ggplot2::ggplot() +
geom_timeline_label(aes(x = DATE, xmin = XMin, xmax = XMax, n_max = 5, y = COUNTRY, label = LOCATION, size = EQ_PRIMARY, mag = EQ_PRIMARY, colour = TOTAL_DEATHS)) +
ggplot2::labs(x = 'Date', y = 'Country', color = '# deaths', size = 'Richter scale value') +
ggplot2::lims(x = c(XMin, XMax))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.