Description Usage Format Value Examples
Defines the GeomTimelineLabel ggplot2 geom, which draw line markers and text. Use geom_timeline_label
to add a GeomTimelineLabel layer to ggplot. The required aesthetic x
specifies where to place a marker, the second required aesthetic mag
determines what quantity is used from the input data to determine which observations are marked, the final required aesthetic label
determines which column in the input data to use for labels. The optional aesthetic y
, color
, and alpha
determines the stratification, color, transparency respectively. The final optional aesthetic n_max
determines how many markers to place.
1 |
An object of class GeomTimelineLabel
(inherits from Geom
, ggproto
, gg
) of length 6.
Geom*
object for marking and labeling 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 | ## 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()
ggplot2::ggplot() +
ggplot2::layer(geom = GeomTimelineLabel,
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.