The behaviour of scale_*_discrete(drop = FALSE) stopped working/changed its behaviour for ggplot2 < 3.5.0 (without that I was able to find information about it in the changelog) . The legend does not longer show the colour/symbols for levels without data.
This issue is a duplicate of #5728.
In short, you'd need to use show.legend = TRUE if you want to display keys for data that isn't present in the legend.
The behaviour of
scale_*_discrete(drop = FALSE)
stopped working/changed its behaviour forggplot2 < 3.5.0
(without that I was able to find information about it in the changelog) . The legend does not longer show the colour/symbols for levels without data.ggplot2 version 3.5.1
ggplot2 version 3.4.4
Created on 2024-07-01 with reprex v2.1.0