Description Usage Arguments Value Note Examples
The geom_timeline
function displays timelines of earthquakes based on the GeomTimeline
.
1 2 3 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer.
If |
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 |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
other arguments passed on to |
A timeline plot with one point symbol for each date.
The function only returns reasonable results for CE (Common Era) dates,
because the lubridate
package cannot handle BCE (Before Common Era) dates, yet.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # size and colour as figure 1 of module 2
file <- system.file("extdata", "earthquakes.tsv.gz", package = "NOAAeq")
library(magrittr)
readr::read_delim(file = file, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter(lubridate::year(DATE) %in% 2000:2017 & COUNTRY == "USA") %>%
ggplot(aes(x = DATE, size = EQ_PRIMARY, fill = TOTAL_DEATHS)) +
geom_timeline() +
theme_classic() +
theme(legend.position = "bottom") +
scale_size_continuous(name = "Richter scale value") +
scale_fill_continuous(name = "# deaths") +
guides(size = guide_legend(order = 1),
fill = guide_colourbar(order = 2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.