Dear R community In the meantime I made some progress: ggplot(data = Fig2b, aes(x = BFF, y = Wert, fill = Effekt))+theme_bw()+ geom_bar(stat = "identity", width = 0.95) + scale_y_continuous(limits=c(0,13), expand=c(0,0))+ facet_wrap(~Aspekt, strip.position = "bottom", scales = "free_x") + theme(panel.spacing = unit(0, "lines"), strip.background = element_blank(), strip.placement = "outside")+ theme(axis.title.x=element_blank())+ scale_fill_manual("Effekt", values = c("Neg" = "red", "Neu" = "darkgrey", "Pos" = "blue"), labels=c("Negativ", "Nicht sign.", "Positiv")) Question - Is it possible to present all the subpolots in one graph (not to "lines")?
- I tried to change the angel of the x-axis. However, I was able to change the first x-axis (BB...), but not the second one (Voegel....). Maybe this would solve the problem. - If not, is there another possibility to fix the number of subplots per line? Kind regards Sibylle -----Original Message----- From: R-help <r-help-boun...@r-project.org> On Behalf Of SIBYLLE STÖCKLI via R-help Sent: Saturday, December 16, 2023 12:16 PM To: R-help@r-project.org Subject: [R] ggplot 3-dimensions Dear R-user Does anybody now, if ggplot allows to use two x-axis including two dimensions (similar to excel plot (picture 1 in the pdf attachmet). If yes, how should I adapt my code? The parameters are presented in the input file (attachment: Input). Fig2b = read.delim("BFF_Fig-2b.txt", na.strings="NA") names(Fig2b) head(Fig2b) summary(Fig2b) str(Fig2b) Fig2b$Aspekt<-factor(Fig2b$Aspekt, levels=(c("Voegel", "Kleinsaeuger", "Schnecken", "Regenwuermer_Asseln", "Pilze"))) ### Figure 2b ggplot(Fig2b,aes(Aspekt,Wert,fill=Effekt))+ geom_bar(stat="identity",position='fill')+ scale_y_continuous(limits=c(0,14), expand=c(0,0))+ labs(x="", y="Anzahl Studien pro Effekt") Kind regards Sibylle
ggplot_3dim.pdf
Description: Adobe PDF document
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.