Dear all,
I want to change the color and the size of my box plot manually.
I used this command " scale_fill_manual" but it did not work.
Here is my script,
library(datasets)
library(ggplot2)
library(multcompView)
library(dplyr)
library(datasets)
Data = read.csv("datastrain.csv", h= TRUE)
#anova analysis
anova <- aov(Ratio ~ Strain, data = Data)
summary(anova)
# Tukey's test
tukey <- TukeyHSD(anova)
print(tukey)
# compact letter display
coba = multcompLetters4(anova, tukey)
print(coba)
# table with factors and 3rd quantile
Tk <- group_by(Data, Strain) %>%
summarise(mean=mean(Ratio), quant = quantile(Ratio, probs = 0.75)) %>%
arrange(desc(mean))
# extracting the compact letter display and adding to the Tk table
coba <- as.data.frame.list(coba$Strain)
Tk$coba <- coba$Letters
print(Tk)
p = ggplot(Data, aes(Strain, Ratio, col= Strain)) +
geom_boxplot(aes(fill = Strain), show.legend = FALSE) +labs(x="Strain", y="Ratio") +
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
geom_text(data = Tk, aes(x = Strain, y = quant, label = coba), size = 5, vjust=-1, hjust =-2) + scale_color_manual(values=c("purple", "#4CBB17","#0096FF","#FFC300", "grey", "black", "red"))
here is my data data
I hope someone can help me.
Thank!