Description Usage Arguments Value Examples
This function creates a plot showing earthquakes by date, country, and city or region. It is similar to geom_timeline, but has the option to add labels showing the city or region in which the earthquake took place. It uses the GeomTimelineLabel geom.
1 2 3 |
mapping |
An aesthetic mapping created by ggplot2::aes. |
data |
A data frame containing the data to be plotted. |
stat |
A string indicating the data transformation to be used. |
position |
A string giving the poistion adjustment. |
na.rm |
A logical controlling how missing values are handled. If FALSE, missing values are removed and a warning is printed, otherwise missing values are removed without a warning. |
show.legend |
A logical indicating whether the layer created by this function should have a legend. |
inherit.aes |
A logical. If FALSE, the default aesthetics are overridden. |
n_max |
A integer constant. If n_max is used, only the n_max largest earthquakes, as determined by the value of size, are given labels. The default behavior is to label all earthquakes. |
... |
additional arguments passed to the layer. |
This function adds an earthquake timeline plot with labels to the current ggplot.
1 2 3 4 5 6 | eq_data <- eq_clean_data("NOAA_earthquakes.txt")
eq_data <- subset(eq_data, Country == "Mexico" & YEAR >= 2000)
ggplot2::ggplot(eq_data) +
geom_timeline_label(ggplot2::aes(x=DATE, y=Country, fill=TOTAL_DEATHS,
size=EQ_PRIMARY, label=LocalLocation))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.