# Kóði - breyta lit á stjörnum um significance

Mjá. Elska þig.
unknown
plain_text
2 years ago
1.6 kB
1
Indexable
Never
#Kóðinn sem ég er að vinna með

ggplot(v_by_treatment, aes(x = Treatment, y = kornsura, color = Treatment)) + scale_color_manual(values=c("#6699CC", "#CC6677")) +
ylab("Bistorta vivipara, % cover") +
geom_boxplot()  +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"), text=element_text(size=18), axis.text=element_text(size=16), axis.title = element_text(size=16), legend.position = "none") +
geom_signif(comparisons = list(c("Ctrl", "OTC")), map_signif_level=TRUE)

# er að nota þetta, af þessari síðu: https://stackoverflow.com/questions/17084566/put-stars-on-ggplot-barplots-and-boxplots-to-indicate-the-level-of-significanc

library(ggplot2)
library(ggsignif)

ggplot(iris, aes(x=Species, y=Sepal.Length)) +
geom_boxplot() +
geom_signif(comparisons = list(c("versicolor", "virginica")),
map_signif_level=TRUE)

# ooog hélt ég gæti gert þetta með litinn, en það virkar ekki (þeas bæta scale_fill_manual ....)

ggplot(dat, aes(Group, Value)) +
geom_bar(aes(fill = Sub), stat="identity", position="dodge", width=.5) +
geom_signif(stat="identity",
data=data.frame(x=c(0.875, 1.875), xend=c(1.125, 2.125),
y=c(5.8, 8.5), annotation=c("**", "NS")),
aes(x=x,xend=xend, y=y, yend=y, annotation=annotation)) +
geom_signif(comparisons=list(c("S1", "S2")), annotations="***",
y_position = 9.3, tip_length = 0, vjust=0.4) +
scale_fill_manual(values = c("grey80", "grey20"))