Count Plots

Another great way to represent two pseudometric variables is the count plot. Here, combinations that occur more frequently are displayed larger. To do this, we call the geom_count() function:

countplot <- ggplot( 
  pss, 
  aes(
    trstplt, 
    trstlgl
  )
) + 
  geom_count()

countplot
## Warning: Removed 23 rows containing non-finite outside the scale range
## (`stat_sum()`).

Coloring

Here we can also add colors:

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()`).

Lastly, you will learn how to represent a bivariate distribution as well!