Description Usage Arguments Details Aesthetics Examples
This geom plots a timeline, with circles showing the dates when the event occurred.
It is intended for the purposes of graphically exploring the NOAA Significant
Earthquake Database (included in this package), but can show any data with a column
of valid date
objects
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 |
(optional) Stat Override the default Stat transformation of 'timeline' |
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 |
x_min |
(optional) A Date object of the earliest data to be plotted |
x_max |
(optional) A Date object of the latest data to be plotted |
... |
other arguments passed on to |
This is a general purpose timeline plotting geom, particularly tuned to
the NOAA Significant Earthquake Database included with this package. Each event
with an associated date will be plotted as a circle on the timeline, so long as
the event lies between x_min
and x_max
.
Additional optional aesthetics make the geom much more useful. An optional
y
aesthetic allows the comparison of different timelines over the same range.
Size can show how big an event was (such as an earthquake), and color/fill and alpha
can convey yet more information
geom_timeline
understands the following aesthetics (required are in bold):
x
y
color
fill
size
alpha
1 2 3 4 5 6 7 8 9 | data('clean_NOAA')
NOAA <- clean_NOAA
plot_NOAA <- NOAA[NOAA$COUNTRY=="USA" | NOAA$COUNTRY=="CANADA",]
xmin <- lubridate::ymd("2010-01-01")
xmax <- lubridate::ymd("2017-07-01")
plt <- ggplot2::ggplot(data = plot_NOAA, ggplot2::aes(x = DATE, y = COUNTRY)) +
geom_timeline(ggplot2::aes(size = EQ_PRIMARY), x_min = xmin, x_max = xmax) +
ggplot2::theme_minimal()
print(plt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.