Description Usage Format Value Examples
Defines the GeomTimeline ggplot2 geom. It is recommended to use the geom_timeline
function to create these layers. The only required aesthetic is x
which determines where along the line to place the circles. The optional aesthetics color
, size
, and alpha
define the color, radius and transparency of the circle, and the optional aesthetic y
can be used for making multiple stratified timelines.
1 |
An object of class GeomTimeline
(inherits from Geom
, ggproto
, gg
) of length 6.
Geom*
object for rendering timelines on plots
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 | ## Not run:
# All deadly earthquakes in JAPAN, CHINA and NEPAL since 2000
data <- eq_clean_data() %>%
dplyr::filter(!is.na(TOTAL_DEATHS)) %>%
dplyr::select(DATE, YEAR, COUNTRY, REGION, LONGITUDE, LATITUDE, MAG, TOTAL_DEATHS) %>%
tidyr::drop_na() %>%
dplyr::filter(YEAR > 1999, COUNTRY %in% c("JAPAN", "CHINA","NEPAL"))
# Plot Timeline
ggplot2::ggplot() +
ggplot2::layer(geom = GeomTimeline,
mapping = aes(x = data$DATE,
y = data$COUNTRY,
size = data$MAG,
color = data$TOTAL_DEATHS),
data = data,
stat = 'identity',
position = 'identity',
show.legend = NA,
inherit.aes = TRUE,
params = list(na.rm = FALSE))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.