Last active
May 27, 2023 05:10
-
-
Save baptiste/5420f696ae45fb535845305cebeea654 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(readr) | |
library(ggfittext) | |
d <- read_csv('PrevalenceAtLarge.csv') | |
d$value <- cut(d$PercentAtLarge, breaks = 5, | |
labels = c("doubling under 6 weeks", | |
"doubling in 2–6 weeks", | |
"stable", | |
"halving in 2–6 weeks", | |
"halving under 6 weeks")) | |
d$label <- format(d$PercentAtLarge, digits=1) | |
d$DHB <- factor(d$DHB, levels = rev(unique(d$DHB))) | |
ggplot(d, aes(Age, DHB, fill = value, label = label)) + | |
geom_tile(col='grey',lwd=0.3) + | |
geom_fit_text(reflow = FALSE, grow = FALSE, contrast = TRUE, show.legend = FALSE) + | |
scale_fill_brewer("",palette = "PRGn") + | |
theme_bw() + | |
theme(panel.border = element_rect(fill = NA, | |
colour = 'grey90')) + | |
scale_x_discrete(expand=c(0,0))+ | |
scale_y_discrete(expand=c(0,0)) + | |
guides(fill=guide_legend()) + | |
labs(x="",y="") | |
ggsave('covid_horiz.png',width=8, height=4) | |
Author
baptiste
commented
May 27, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment