gglot2's theme for the geom_timeline
and
geom_timeline_label
geoms.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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)
clean_data <- eq_location_clean(clean_data)
# Quakes in Indonesia
timeline_plot <- clean_data %>%
filter(COUNTRY == "INDONESIA",
!is.na(EQ_PRIMARY),
YEAR %in% 2000:2016) %>%
ggplot(mapping = aes(x = DATE,
size = EQ_PRIMARY,
color = TOTAL_DEATHS / 1000,
label = LOCATION_NAME)
) +
geom_timeline() +
geom_timeline_label(line_height = 1 / 4) +
labs(size = "Richter scale value",
color = "# deaths in thousands",
y = "")
# Sans the new theme.
timeline_plot
# With the timeline's theme.
timeline_plot + theme_timeline()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.