Hallo,
ich habe leider Probleme beim Darstellen meiner Daten: ( )
Ich möchte gerne meine Ergebnisse durch Boxplots darstellen.
Dabei geht es um drei verschiedene Behandlungen, auf zwei verschiedenen Standorten.
Boden3boxplot <- ggplot(data=Boden3, aes(x=Variante,y=infiziert, color=Feld))+geom_boxplot()+theme_test()+
stat_boxplot(geom="errorbar", width=0.8)
Boden3boxplot
Schaut ja so schon ok aus, aber ich will kein Kreuz in der Box und bekomme es nicht raus.
Dazu würde ich gerne die Farben ändern, in klassische Grautöne. Dabei sollen die Datend der gleichen Felder/Standorte gleich bleiben
und sich von dem anderen Feld absetzen.
Kann mir jemand Helfen, für ewige Dankbarkeit?
Vielen Dank fürs Anschauen,
Fanny
ggplot2, Boxplots
Re: ggplot2, Boxplots
Hallo Fanny,
Du weißt doch sicher, dass das "Kreuz" ein wesentlicher Bestandteil des Boxplots ist (es visualisiert den Median)? Ohne diese Verteilungsinformation ist der Boxplot kein Boxplot. Ich kenne Deine Daten natürlich nicht, aber diese Form der Darstellung sieht für mich nicht optimal aus. Vielleicht gibt es eine optimalere Darstellungsform für die vorliegende Verteilung?
Du weißt doch sicher, dass das "Kreuz" ein wesentlicher Bestandteil des Boxplots ist (es visualisiert den Median)? Ohne diese Verteilungsinformation ist der Boxplot kein Boxplot. Ich kenne Deine Daten natürlich nicht, aber diese Form der Darstellung sieht für mich nicht optimal aus. Vielleicht gibt es eine optimalere Darstellungsform für die vorliegende Verteilung?
Viele Grüße,
Student
-----------------------------------------------------------------------------------------------------------------------
faes.de, Datenanalyse mit R & das Ad-Oculos-Projekt
Das Ad-Oculos-Projekt auf YouTube
Habe Mut, dich deines eigenen Verstandes zu bedienen! (Kant)
Student
-----------------------------------------------------------------------------------------------------------------------
faes.de, Datenanalyse mit R & das Ad-Oculos-Projekt
Das Ad-Oculos-Projekt auf YouTube
Habe Mut, dich deines eigenen Verstandes zu bedienen! (Kant)
Re: ggplot2, Boxplots
Hallo,
für alle die mitmachen wollen, hier sind die Daten in Code:
und die Kernfrage dazu lautet, was an der Darstellung ohne Errorbar auszusetzen ist:
So sehen Boxplots in ggplot2 nunmal aus und so ist in der Mitte auch kein Kreuz. Geht es einfach nur darum, dass die Whisker am Ende einen Querstrich brauchen, wie in base graphics, also bsp.
Die Farben und Füllungen der Boxplots in ggplot2 kannst Du über scale_fill_manual() selbst vorgeben, also beispielsweise so:
HTH,
Bernhard
für alle die mitmachen wollen, hier sind die Daten in Code:
Code: Alles auswählen
boden <- structure(list(Variante = c("Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle", "Kontrolle",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha", "1 Mrd. EPNs/ha",
"1 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha",
"5 Mrd. EPNs/ha", "5 Mrd. EPNs/ha"), Feld = c("Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Stove", "Stove", "Stove", "Stove",
"Stove", "Stove", "Stove", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee",
"Bocksee", "Bocksee", "Bocksee", "Bocksee", "Bocksee"), infiziert = c(0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 3L, 2L, 3L, 1L, 3L, 1L, 3L, 2L,
3L, 5L, 2L, 4L, 5L, 4L, 1L, 4L, 1L, 3L, 3L, 2L, 4L, 3L, 0L, 4L,
4L, 4L, 1L, 2L, 1L, 3L, 4L, 5L, 5L, 2L, 4L, 3L, 2L, 0L, 1L, 5L,
5L, 3L, 5L, 2L, 4L, 3L, 0L, 3L, 4L, 5L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 5L, 1L, 1L, 1L, 0L, 0L, 0L, 2L, 1L, 0L, 1L, 0L,
1L, 0L, 5L, 0L, 0L, 0L, 2L, 2L, 0L, 5L, 0L, 0L, 0L, 1L, 2L, 1L,
0L, 0L, 5L, 0L, 2L, 1L, 0L, 1L, 1L, 1L, 0L, 2L, 0L, 2L, 1L, 2L,
0L, 1L, 2L, 5L, 1L)), class = "data.frame", row.names = c(NA,
-150L))
str(boden)
Code: Alles auswählen
library(ggplot2)
Boden3boxplot <- ggplot(data=boden, aes(x=Variante,y=infiziert, color=Feld)) +
geom_boxplot() +
theme_test()
print(Boden3boxplot)
Code: Alles auswählen
boxplot(infiziert ~ Variante + Feld, data = boden)
Code: Alles auswählen
Boden3boxplot <- ggplot(data=boden, aes(x=Variante,y=infiziert, fill=Feld)) +
geom_boxplot() +
theme_test() +
scale_fill_manual(values = c("darkgrey", "lightgrey"))
print(Boden3boxplot)
Bernhard
---
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte