Skip to content

Instantly share code, notes, and snippets.

@ATpoint
Created May 31, 2023 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ATpoint/93a88995bdfbcb29b6c423f851786b99 to your computer and use it in GitHub Desktop.
Save ATpoint/93a88995bdfbcb29b6c423f851786b99 to your computer and use it in GitHub Desktop.
# Murine peripheral blood cell numbers based on:
# https://www.stemcell.com/media/files/wallchart/WA10011-Frequencies_Percentages_Mouse_Immune_Cell_Types.pdf
library(magrittr)
library(patchwork)
library(tidyverse)
options(ggplot2.discrete.fill=c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442",
"#0072B2", "#D55E00", "#CC79A7"))
blood <- data.frame(Ery=10.6*10^6,
Platelet=1157*10^3,
Lympho=2*10^3,
Mono=0.04*10^3,
Neutro=0.5*10^3,
Eo=0.06*10^3,
Baso=0.005*10^3) %>%
t %>% magrittr::set_colnames(c("per.µl")) %>%
data.frame %>%
rownames_to_column("celltype") %>%
mutate(percent=100*`per.µl`/sum(`per.µl`))
p1 <-
blood %>%
ggplot(aes(x="", y=percent, fill=celltype)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
theme_void() +
ggtitle("all cells")
p2 <-
blood %>%
filter(!celltype %in% c("Ery")) %>%
ggplot(aes(x="", y=percent, fill=celltype)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
theme_void() +
ggtitle("no red blood cells")
p3 <-
blood %>%
filter(!celltype %in% c("Ery", "Platelet")) %>%
ggplot(aes(x="", y=percent, fill=celltype)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
theme_void() +
ggtitle("no red blood cells and platelets")
p4 <-
blood %>%
filter(!celltype %in% c("Ery", "Platelet", "Lympho")) %>%
ggplot(aes(x="", y=percent, fill=celltype)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
theme_void() +
ggtitle("only myeloid")
(p1 | p2) / (p3 | p4)
@ATpoint
Copy link
Author

ATpoint commented May 31, 2023

Rplot01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment