Description Usage Arguments Value Examples
View source: R/geom_timeline.R
Adding labels to a geom_timeline layer
1 2 3 |
mapping |
aesthetic mappings |
data |
data to be visualized by the geom |
stat |
character. The statistical transformation to use on the data for this layer, as a string |
position |
character. Position adjustment, either as a string, or the result of a call to a position adjustment function |
na.rm |
logical. variable to indicate if NAs should be removed from the data |
show.legend |
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. |
inherit.aes |
logical. If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification. |
... |
Other arguments passed on to the layer |
Returns a layer, a combination of data, stat and geom objects including labels for certain data-points.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #
## Not run:
data <- readr::read_delim("signif.txt", delim = "\t")
data <- eq_clean_data(data)
data %>%
dplyr::filter(COUNTRY == c("USA","CHINA") & lubridate::year(DATE) >= 2008) %>%
ggplot(aes(x=DATE,y=COUNTRY,color=TOTAL_DEATHS,size=EQ_PRIMARY)) +
geom_timeline(alpha=.5) +
geom_timelinelabel(aes(label=LOCATION_NAME),n_max=3) +
theme(legend.position="bottom", legend.box="horizontal", plot.title=element_text(hjust=0.5)) +
ggtitle("Earthquakes Visualization Tool") +
labs(size = "Richter scale value", color = "# Deaths")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.