Description Usage Arguments Value Examples
The geom_timeline_label
function displays timeline labels based on the GeomTimelineLabel
.
It is usually used together with the geom_timeline
function.
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 |
Timeline labels are added to a timeline plot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # stratification and text annotations as in figure 3 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 %in% c("USA", "CHINA")) %>%
ggplot(aes(x = DATE, y = COUNTRY, fill = TOTAL_DEATHS)) +
geom_timeline() +
geom_timeline_label(aes(label = LOCATION_NAME, col_max = EQ_PRIMARY), n_max = 5) +
theme_classic() +
theme(legend.position = "bottom",
axis.title.y = element_blank(), axis.ticks.y = element_blank(),
axis.line.y = element_blank()) +
scale_fill_continuous(name = "# deaths", breaks = c(1, 87652))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.