Description Usage Arguments Value Examples
This geom and geom_timeline function will plot a time line of earthquakes ranging from xmin to xmax dates with a point for each earthquake. Optional aesthetics include color, size, and alpha (for transparency). The x aesthetic is a date and an optional y aesthetic is a factor indicating some stratification in which case multiple time lines will be plotted for each level of the factor (e.g. country).
1 2 3 |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
xmin |
A Date class date which specifies the minimum timeline range.
This is optional. If not specified, The minimum timeline range of the
|
xmax |
A Date class date which specifies the maximum timeline range.
This is optional. If not specified, The maximum timeline range of the
|
... |
other arguments passed on to |
plot of a time line of earthquakes ranging from xmin to xmax dates with a point for each earthquake.
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 | ## Not run:
library(dplyr)
library(lubridate)
data(raw_df)
test_df <- raw_df %>% eq_clean_data() %>%
filter(COUNTRY == "TURKEY" | COUNTRY == "JAPAN") %>%
dplyr::filter(DATE >= eq_date("2000-01-01") & DATE <= eq_date("2017-01-01"))
## End(Not run)
## Not run:
ggtimeline <- ggplot2::ggplot(test_df) +
geom_timeline(ggplot2::aes(
x = DATE,
y = COUNTRY,
size = EQ_PRIMARY,
fill = TOTAL_DEATHS)
) +
eq_theme +
ggplot2::scale_size_continuous(name = "Richer scale value", breaks = c(0, 2, 4, 6, 8)) +
ggplot2::scale_fill_continuous(name = "# deaths") +
ggplot2::ggtitle("Earthquakes")
ggtimeline
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.