Description Usage Arguments Examples
View source: R/Module2_functions.R
This function adds annotations to the timeline plot. There is an option to subset to n_max
to select the number of annotated earthquakes ordered by magnitude.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
mapping |
List of aesthetic created by aes() to use for plot. |
data |
The data to be displayed in this layer. NULL, the default, is the data inherited from the plot data as specified in the call to ggplot(). |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment. |
... |
Other arguments passed on to layer. |
nudge_x |
Horizontal adjustment to nudge labels by. |
nudge_y |
Vertical adjustment to nudge labels by. |
na.rm |
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed. |
show.legend |
Logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. |
inherit.aes |
Will aesthethics be inherited (TRUE/FALSE). If FALSE, overrides the default aesthetics, rather than combining with them. |
n_max |
Number of labels, ordered by magnitude. Default is 5. |
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
readr::read_delim("signif.txt", delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter((COUNTRY == "USA" | COUNTRY == "CHINA") & (lubridate::year(DATE) >= 2000 &
lubridate::year(DATE) <= 2015)) %>%
ggplot() +
geom_timeline( aes(x = DATE, y = COUNTRY, size = EQ_PRIMARY, fill = DEATHS)) +
geom_timeline_label( aes(x = DATE, y = COUNTRY, label = LOCATION_NAME,
n_max = 1, size = EQ_PRIMARY)) +
theme_eq
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.