Eine andere gute Möglichkeit, um zwei pseudometrische Variablen darzustellen, ist der count plot. Hier werden die Kombinationen, die häufiger vorkommen größer dargestellt. Dazu rufen wir die Funktion geom_count()
auf:
countplot <- ggplot(
pss,
aes(
trstplt,
trstlgl
)
) +
geom_count()
countplot
## Warning: Removed 23 rows containing non-finite outside the scale range
## (`stat_sum()`).
Auch hier können wir Farben hinzufügen:
ggplot(
pss,
aes(
trstplt,
trstlgl)) +
geom_count(
aes(
color = ..n..,
size = ..n..
)
) +
guides(color = "legend")
## Warning: The dot-dot notation (`..n..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(n)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Removed 23 rows containing non-finite outside the scale range
## (`stat_sum()`).
Zuguterletzt lernst du noch kennen, wie du eine bivariate Verteilung auch darstellen kannst!