Description Usage Arguments Value Aesthetics Examples
A ggplot2 graphical function that adds labels to earthquakes visualised. There is an option to select the "n" largest earthquakes by magnitude to which to apply the labels. Best used with 'eq_location_clean'.
1 2 3 4 5 6 7 8 9 10 |
mapping |
mapping |
data |
data |
stat |
stat |
position |
position |
na.rm |
na.rm |
show.legend |
show.legend |
inherit.aes |
inherit.aes |
... |
... |
A ggplot2 graphical object for labelling plots generated with geom_timeline.
geom_timeline_label understands the following aesthetics:
x date
y (optional) aes can be used to group output eg by COUNTRY
location aes used to selection labels eg LOCATION_NAME
xmin minimum date for earthquakes
xmax maximum date for earthquakes
size aes used to indicate size eg EQ_PRIMARY
n_max the top n number of labels to show based on size aes, defaults to n = 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(dplyr)
library(ggplot2)
library(lubridate)
eq_clean_data(eq_data_raw) %>% eq_location_clean() %>%
dplyr::filter(COUNTRY %in% c("USA","IRAN")) %>%
ggplot2::ggplot() +
geom_timeline(aes(x = date,
y = COUNTRY,
colour = DEATHS,
size = EQ_PRIMARY,
fill = DEATHS,
xmin = lubridate::ymd_hm("2000-01-01",truncated=2),
xmax = lubridate::ymd_hm("2016-01-01",truncated=2))) +
geom_timeline_label(aes(x = date,
location = LOCATION_NAME,
xmin = lubridate::ymd_hm("2000-01-01",truncated=2),
xmax = lubridate::ymd_hm("2016-01-01",truncated=2),
size=EQ_PRIMARY,n_max=5,y=COUNTRY))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.