-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFigure_scores.R
22 lines (20 loc) · 1.11 KB
/
Figure_scores.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(ggplot2)
#install.packages("remotes") # Install remotes package
#remotes::install_github("coolbutuseless/ggpattern")
library(ggpattern)
path <- "C:/Users/milil/OneDrive - Universidad de Córdoba/Scripts/wheatAHP/"
Score <- read.table(paste0(path,"./results/table_scores.txt"), sep="\t", header=TRUE, row.names = 1)
rawdata <- read.table(paste0(path,"./Input/Data_matrix_AHP.csv"), sep=";", header=TRUE, row.names = 1)
scoredata <- merge(Score[, c("mean", "sd")], rawdata[, c("genus", "rye")], by = "row.names")
names(scoredata)[names(scoredata) == 'Row.names'] <- 'Genotypes'
ggplot(scoredata, aes(reorder(Genotypes, mean), y=mean, fill = genus, pattern = rye)) +
geom_bar(stat="identity", color = "black") +
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=.4,
position=position_dodge(.9)) +
geom_bar_pattern(stat = "identity", pattern_color = "black",
pattern_fill = "black", pattern_spacing = 0.015, pattern_density = 0.02) +
scale_pattern_manual(values = c(N = "none", Y = "stripe")) +
xlab("Genotypes") +
ylab("score") +
coord_flip() +
theme_classic()