Huhu,
ich habe folgendes Problem....
Ich möchte die Skalenbereich der Y Achse vergrößern damit ich über den Errorbars noch Buchstaben einfügen kann. Jedoch verändert sich bei mir immer der Balken-bereich sodass dort die Werte falsch sind. Bei einer anderen Grafik habe ich es über "limits"schon hin bekommen, jedoch finde ich nicht den Fehler bei dieser
So sieht es bisher aus:
(a) ohne Veränderung der Y-Achse- oben ist halt nicht genügend Platz um meine Buchstaben vom "cld" einzufügen
(b) mit "limits" habe ich die Y-Achse vergrößert aber es haben sich die Werte der Balken verändern
-> es ist wichtig das die Y Achse direkt bei null startet (expand)
Das sind meine Daten:
Pflanze Genotyp Datum GrammW Wurzellänge
A 1 16Juni2020 0,724134674 0,000361596
A 1 18Juni2020 1,245255449 0,00073834
A 2 17Juni2020 1,620862256 0,000199071
A 1 17Juni2020 0,912575424 0,000926556
A 2 18Juni2020 1,053816247 0,000699471
A 1 16Juni2020 0,970577918 0,000552514
A 2 16Juni2020 0,833114093 0,000692559
A 2 17Juni2020 0,904340535 0,0009637
A 1 17Juni2020 1,3345077 0,0008288
A 2 16Juni2020 0,622956365 0,000447445
B 1 16Juni2020 1,812171287 0,00081065
B 2 16Juni2020 2,105358889 0,002651254
B 1 16Juni2020 1,999156848 0,001611501
B 2 17Juni2020 2,009434969 0,00276132
B 1 17Juni2020 2,542237169 0,001222255
B 2 16Juni2020 1,153314917 0,000612563
B 1 18Juni2020 1,645903297 0,00114166
B 2 18Juni2020 1,28986524 0,000593003
B 1 17Juni2020 2,243845231 0,002683788
B 2 17Juni2020 1,457608622 0,002754413
C 1 17Juni2020 3,558308395 0,002495111
C 2 16Juni2020 2,674342581 0,001564507
C 1 16Juni2020 2,998388582 0,001832873
C 2 16Juni2020 3,034231527 0,001321563
C 1 18Juni2020 2,524554942 0,001457107
C 2 17Juni2020 2,586581747 0,001647964
C 1 16Juni2020 2,468423354 0,001539681
C 2 17Juni2020 2,961087238 0,003721508
C 1 17Juni2020 3,42174316 0,001721743
C 2 18Juni2020 2,677893269 0,001492674
D 1 17Juni2020 5,489180479 0,002665528
D 2 16Juni2020 4,04561699 0,002649844
D 1 16Juni2020 4,883398514 0,003096948
D 2 17Juni2020 5,70049792 0,0025544
D 1 17Juni2020 3,650245549 0,002869136
D 2 16Juni2020 3,793476471 0,002087923
D 1 16Juni2020 4,646097698 0,002347301
D 2 17Juni2020 3,43042228 0,001770082
D 1 18Juni2020 4,996063202 0,002383008
D 2 18Juni2020 4,886245474 0,002196911
E 1 18Juni2020 4,438443143 0,004066087
E 2 17Juni2020 4,592409136 0,002826479
E 1 16Juni2020 3,341006753 0,00198484
E 2 16Juni2020 3,475947723 0,002484738
E 1 16Juni2020 3,285664866 0,002666232
E 2 16Juni2020 4,165110519 0,002706279
E 1 17Juni2020 5,959688971 0,00327259
E 2 18Juni2020 5,730816452 0,002621071
E 1 17Juni2020 3,926392726 0,002491775
E 2 17Juni2020 4,073093582 0,004670041
Das ist mein bisheriges Skript ( inklusive Statistik wo die Buchstaben ausgeworfen werden):
#GrammWmer
plot(GrammW~Pflanze+Genotyp, data=WPA.df)
GrammW.lmer<-lmer(GrammW~Pflanze+Genotyp+Pflanze:Genotyp+(1|Datum),data=WPA.df)
summary(GrammW.lmer)
anova(GrammW.lmer)
ranova(GrammW.lmer)
WPA.df$PflanzeGeno <- interaction(WPA.df$Pflanze, WPA.df$Genotyp)
model <- lmer(GrammW ~ PflanzeGeno+(1|Datum),data=WPA.df)
comp.Pflanzegeno <- glht(model, linfct=mcp(PflanzeGeno="Tukey"))
comp.Pflanzegeno
cld(comp.Pflanzegeno, level=0.05)
#Wurzellängelmer
plot(Wurzellänge~Pflanze+Genotyp, data=WPA.df)
Wurzellänge.lmer<-lmer(Wurzellänge~Pflanze+Genotyp+Pflanze:Genotyp+(1|Datum),data=WPA.df)
summary(Wurzellänge.lmer)
anova(Wurzellänge.lmer)
ranova(Wurzellänge.lmer)
WPA.df$PflanzeGeno <- interaction(WPA.df$Pflanze, WPA.df$Genotyp)
model <- lmer(Wurzellänge ~ PflanzeGeno+(1|Datum),data=WPA.df)
comp.Pflanzegeno <- glht(model, linfct=mcp(PflanzeGeno="Tukey"))
comp.Pflanzegeno
cld(comp.Pflanzegeno, level=0.05)
Grafik:
library(cowplot)
install.packages("hmisc")
library(tidyverse)
library(patchwork)
item_labels <- c("Kuba",
"Cardoso")
variable_names <- list(
"A" = "100 mg P" ,
"B" = "50 mg P",
"C" = "25 mg P",
"D" = "10 mg P",
"E" = "5 mg P"
)
variable_labeller <- function(variable,value){
return(variable_names[value])
}
plot1<-ggplot(WPA.df,aes(x=Genotyp,y=GrammW,fill=Genotyp))+
facet_wrap(~Pflanze,nrow=1,labeller = variable_labeller)+
theme(strip.text.x = element_text(size = 7))+
stat_summary(fun = mean,geom = "bar",
color="black",position = "dodge")+
stat_summary(fun.data = mean_se,
geom = "errorbar",width=0.5,position = position_dodge(0.90))+
ylab("Gramm Wurzel")+
scale_fill_grey(name="",start =0.8, end =0.4)+
ggtitle("(a)")+
theme(legend.position="none",
plot.title = element_text(hjust = 0,vjust = 0))+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(), axis.ticks.x=element_blank())+
scale_y_continuous( expand = c(0, 0))
plot2<-ggplot(WPA.df,aes(x=Genotyp,y=Wurzellänge,fill=Genotyp))+
facet_wrap(~Pflanze,nrow=1,labeller=variable_labeller)+
theme(strip.text.x = element_text(size = 7))+
stat_summary(fun = mean,geom = "bar",
color="black",position = "dodge")+
stat_summary(fun.data = mean_se,
geom = "errorbar",width=0.5,position = position_dodge(0.90))+
ylab("Wurzellänge")+
scale_fill_grey(name="",start =0.8, end =0.4)+
ggtitle("(b)") +
theme(legend.position="none",
plot.title = element_text(hjust = 0,vjust = 0,5))+
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(), axis.ticks.x=element_blank())+
scale_y_continuous(limits= c(0,0.0035),expand = c(0, 0))
plot1+plot2
Ich bin für jede Hilfe dankbar.
Viele Grüße