Description Usage Arguments Value Note Examples
View source: R/GeomTimelineLabel.R
This geom creates labels for a timeline plot using dates
(requires x
aesthetics), and the label text (requires label
aesthetics) with optional maximal number of labels (depending on optional
n_max
aesthetics) of the largest events by size param in geom_timeline.
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. |
... |
other arguments passed on to |
na.rm |
If |
n_max |
An integer. If used, it only plots the labels for the
|
xmin |
A date. If used the plot will start from this date |
xmax |
A date. If used the plot will end at this date |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Grob representing labels for timeline(s) with datapoints
required_aes x, label with x the date of data points plotted and label the variable containing the label text
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
eq_data %>% eq_clean_data() %>%
filter(COUNTRY %in% c("GREECE", "ITALY"), year(DATE) > 2000) %>%
ggplot(aes(x = DATE,
y = COUNTRY,
color = TOTAL_DEATHS,
size = EQ_PRIMARY)) +
geom_timeline() +
geom_timeline_label(aes(label = LOCATION), n_max = 8) +
theme_timeline() +
scale_size(name = "Richter scale", limits = c(5, 8)) +
scale_color_gradient(name = "# Deaths", low = "black", high = "blue")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.