Chapter 9 theme_msdr
I have decided to create a new theme because it is a good opportunity to doing it so I have used the default theme and I have changed some visuals. As you can see, I have made a great effort to make it be similar to the example posted in class notebooks.
9.1 Example
Adding theme to a regular plotting of earthquake.
Without theme:
# Path to the raw data.
raw_data_path <- system.file("extdata", "signif.txt", package = "msdr")
# Loading the dataset of Earthquake.
df <- readr::read_delim(file = raw_data_path,
delim = '\t',
col_names = TRUE,
progress = FALSE,
col_types = readr::cols())
# Cleaning the data and filtering.
df %>%
eq_clean_data() %>%
filter(COUNTRY %in% 'USA',
YEAR >= 1900 &
YEAR <= 2000) %>%
# Creating a ggplot object
ggplot() +
# Using the new Geom
geom_timeline(aes(x = DATE,
y = COUNTRY,
size = EQ_PRIMARY,
color = TOTAL_DEATHS)) -> earthquake_usa_1900_2000
# Plotting
earthquake_usa_1900_2000
Adding theme:
# Adding theme.
earthquake_usa_1900_2000 + theme_msdr()