Description Usage Arguments Examples
This is a simple geom function to display
1 2 3 |
mapping |
Mapping |
data |
Data |
stat |
Stat |
position |
position |
... |
nothing special |
na.rm |
Whether remove NA or not |
n_max |
Maximum number of labels |
show.legend |
Show legend |
inherit.aes |
Inherit aes |
1 2 3 4 5 6 7 8 | library(ggplot2)
library(dplyr)
library(grid)
datapath <- system.file("extdata", "earthquakes.txt", package = "gsedr")
data <- readr::read_delim(datapath, delim = "\t") %>% eq_clean_data()
ddd <- data %>% dplyr::filter(COUNTRY %in% c('USA', 'JAPAN','TURKEY','HAITI','INDONESIA')) %>% dplyr::filter(!is.na(EQ_PRIMARY), !is.na(DEATHS)) %>% dplyr::filter(YEAR > 1900)
ddd %>% ggplot(aes(x=DATE,y=COUNTRY,size=as.numeric(EQ_PRIMARY),colour=as.numeric(TOTAL_DEATHS))) + geom_point(alpha=0.6) + geom_timeline_label(aes(label = LOCATION_NAME), n_max = 3) + scale_colour_gradient(low="skyblue",high = "red") + annotate("text", label = "ship", parse=TRUE) + labs(size = "Richter scale value", color = "# deaths") + theme_minimal()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.