-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaster Boxplot.R
More file actions
132 lines (107 loc) · 4.01 KB
/
Master Boxplot.R
File metadata and controls
132 lines (107 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
library(gridExtra)
library(readxl)
library(ggpubr)
library(Rmisc)
library(tidyverse)
library(plyr)
library(GGally)
library(ggplot2)
library(tidyverse)
library(gapminder)
library(dplyr)
library(ggsignif)
library(dplyr)
setwd("C:/Users/edmondsonef/Desktop/R-plots/")
data <- read_excel("C:/Users/edmondsonef/Desktop/TMEM205/MHL 240253 TMEM205.xlsx", sheet = "New")
#data <- dplyr::filter(data, Sex == "M")
#data <- dplyr::filter(data, Group != "F08")
### Albulmin:Globulin Ratio
data<-dplyr:: mutate(data, AGR = (ALB/(TP-ALB)))
data<-dplyr:: mutate(data, BCR = (BUN/CRE))
names <- colnames(data)
# #for 1 levels
# plot_list = list(colnames(data))
# for(i in 10:length(colnames(data))){
# theme_set(theme_bw(12))
# plot_list[[i]] <- local ({
# i <- i
# variable = as.matrix(data[i])
# y_title = colnames(data[i])
# ggplot(data, aes(x = Groups, y = variable, color = Group)) +
# geom_boxplot(outlier.shape=NA, show.legend = F) +
# scale_y_continuous(name = y_title) +
# theme(axis.title.x=element_blank()) +
# geom_point(aes(color = Group),
# position=position_jitterdodge(dodge.width = 0.75, jitter.width = 0.003),
# size = 2)
# })
# }
#for 2 levels
plot_list = list(colnames(data))
for(i in 15:length(colnames(data))){
theme_set(theme_bw(12))
plot_list[[i]] <- local ({
i <- i
variable = as.matrix(data[i])
y_title = colnames(data[i])
ggplot(data, aes(x = Treatment, y = variable, color = Genotype)) +
geom_boxplot(outlier.shape=NA, show.legend = F) +
scale_y_continuous(name = y_title) +
theme(axis.title.x=element_blank()) +
#theme(axis.text.x=element_text(angle=25,hjust=1)) +
geom_point(aes(color = Genotype, shape = Sex),
position=position_jitterdodge(dodge.width = 0.75, jitter.width = 0.003),
size = 2)
})
}
plot_list[[1]]
library(patchwork)
setwd("C:/Users/edmondsonef/Desktop/R-plots/")
tiff("CBC_WBC.tiff", units="in", width=8, height=8, res=200)
(plot_list[[49]] | plot_list[[50]]) /
(plot_list[[51]] | plot_list[[52]]) /
(plot_list[[53]] | plot_list[[54]]) /
(plot_list[[63]] | plot_list[[64]]) /
plot_layout(guides = "collect") +
plot_annotation(title = "CBC: White Blood Cell and Platelet Counts")
dev.off()
tiff("CBC_RBC.tiff", units="in", width=8, height=8, res=200)
(plot_list[[55]] | plot_list[[56]]) /
(plot_list[[57]] | plot_list[[58]]) /
(plot_list[[59]] | plot_list[[60]]) /
(plot_list[[61]] | plot_list[[62]]) /
plot_layout(guides = "collect") +
plot_annotation(title = "CBC: Erythroid Parameters")
dev.off()
tiff("Chemistry.tiff", units="in", width=14, height=12, res=200)
(plot_list[[43]] | plot_list[[31]] | plot_list[[44]] | plot_list[[66]]) /
(plot_list[[36]] | plot_list[[39]] | plot_list[[67]] | plot_list[[40]]) /
(plot_list[[37]] | plot_list[[38]] | plot_list[[42]] | plot_list[[41]]) /
(plot_list[[32]] | plot_list[[33]] | plot_list[[35]] | plot_list[[34]]) /
plot_layout(guides = "collect") +
plot_annotation(title = "Clinical Chemistry")
dev.off()
tiff("Absolute organ weights.tiff", units="in", width=8, height=8, res=200)
(plot_list[[20]] | plot_list[[21]]) /
(plot_list[[23]] | plot_list[[25]]) /
(plot_list[[27]] | plot_list[[29]]) /
#(plot_list[[25]] | plot_list[[27]]) /
plot_layout(guides = "collect") +
plot_annotation(title = "Absolute Organ Weights (grams)")
dev.off()
tiff("Relative organ weights.tiff", units="in", width=8, height=8, res=200)
(plot_list[[20]] | plot_list[[22]]) /
(plot_list[[24]] | plot_list[[26]]) /
(plot_list[[28]] | plot_list[[30]]) /
#(plot_list[[26]] | plot_list[[28]]) /
plot_layout(guides = "collect") +
plot_annotation(title = "Relative Organ Weights (% of body weight)")
dev.off()
# library(patchwork)
#
# tiff("Relative organ weights.tiff", units="in", width=8, height=8, res=200)
# (plot_list[[13]]) /
# (plot_list[[15]] | plot_list[[17]]) /
# plot_layout(guides = "collect") #+
# #plot_annotation(title = "Relative Organ Weights (% of body weight)")
# dev.off()