The primary goal of ervissexplore is to make it easy to
retrieve and filter ERVISS data. The plotting functions
are provided as a convenience for quick exploration, not as a
full-featured visualization framework.
Since the data is returned as a standard data.table, you
are free to build any visualization you want using ggplot2
or any other plotting library.
Each data source has a dedicated plot_*() function and a
quick_plot_*() shortcut.
The quick_plot_*() functions combine data fetching and
plotting in a single call:
# One-liner for ILI rates
quick_plot_ili_ari_rates(
date_min = as.Date("2024-01-01"),
date_max = as.Date("2024-12-31"),
indicator = "ILIconsultationrate",
countries = c("France"),
date_breaks = "1 month"
)You can also use the generic
quick_plot_erviss_data():
plot_erviss_data()The generic function dispatches to the right plot function based on
the type parameter:
All plot_*() functions return standard
ggplot2 objects. You can modify them freely with any
ggplot2 function.
data <- get_sentineltests_positivity(
date_min = as.Date("2024-01-01"),
date_max = as.Date("2024-06-30"),
pathogen = "SARS-CoV-2",
countries = c("France", "Germany")
)
plot_erviss_positivity(data) +
theme_bw() +
theme(
legend.position = "top",
strip.background = element_rect(fill = "steelblue"),
strip.text = element_text(color = "white", face = "bold")
)Since the data is a data.table, you can bypass the
built-in plot functions entirely and create exactly the visualization
you need:
data <- get_nonsentinel_severity(
date_min = as.Date("2024-01-01"),
date_max = as.Date("2024-12-31"),
pathogen = "SARS-CoV-2",
indicator = c("hospitaladmissions", "ICUadmissions"),
age = "total",
countries = c("France", "Spain")
)
ggplot(data, aes(x = date, y = value, fill = indicator)) +
geom_col(position = "dodge") +
facet_wrap(~countryname, scales = "free_y") +
scale_fill_manual(
values = c("hospitaladmissions" = "#E69F00", "ICUadmissions" = "#D55E00"),
labels = c("Hospital admissions", "ICU admissions"),
name = ""
) +
labs(
title = "SARS-CoV-2 severity indicators",
x = NULL,
y = "Count",
caption = "Source: ERVISS / EU-ECDC"
) +
theme_minimal() +
theme(legend.position = "top")data <- get_ili_ari_rates(
date_min = as.Date("2024-01-01"),
date_max = as.Date("2024-12-31"),
indicator = "ILIconsultationrate",
age = "total",
countries = c("Spain", "Austria", "Greece")
)
ggplot(data, aes(x = date, y = countryname, fill = value)) +
geom_tile() +
scale_fill_viridis_c(name = "ILI rate") +
scale_x_date(date_breaks = "1 month", date_labels = "%b") +
labs(title = "ILI consultation rates across Europe", x = NULL, y = NULL) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))