Description Usage Arguments Details Aesthetics Examples
geom_timeline
plots a timeline with points showing the dates when
earthquakes occurred. The color of the points corresponds to the number
of deaths associated with an event and the size of the point corresponds to
the magnitude of the earthquake (higher magnitude creates a larger point).
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 object identifying the earliest date include in the timeline plot. |
xmax |
A Date object identifying the latest date to include in the timeline plot. |
... |
Other arguments passed on to |
This geom is designed to be used with the NOAA Significant Earthquake data set but it can show any data with a data frame of valid date objects.
Each earthquake event with an associated date will be plotted as a
circle on the timeline as long as the event occurs between xmin
and
xmax
.
Additional optional aesthetics can make the geom more useful. The y
aesthetic allows a comparison of two or more timelines over the same date range,
e.g. comparing events for two countries. Size can be used to show the
magnitude of events and color, fill or alpha can convey number of deaths.
geom_timeline
understands the following aesthetics (required aesthetics
in bold):
x
y
]codecolor
fill
size
alpha
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
ggplot(data = earthquakes, aes(x = DATE)) +
geom_timeline(xmin = "2000-01-01", xmax = "2018-12-31",
aes(color = TOTAL_DEATHS, size = EQ_PRIMARY))
The following example includes the \code{y} aesthetic to plot timelines
for each country in the data frame.
ggplot(data = earthquakes, aes(x = DATE, y = COUNTRY)) +
geom_timeline(xmin = "2000-01-01", xmax = "2018-12-31",
aes(color = TOTAL_DEATHS, size = EQ_PRIMARY))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.