tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.39k stars 2k forks source link

Let `Layer$compute_geom_2()` handle legend defaults #5903

Closed teunbrand closed 1 month ago

teunbrand commented 1 month ago

This PR is an amendment to #5834, as it didn't handle the non-standard defaults for geom_sf() legends.

Briefly, this PR let's Layer$compute_geom_2() instead of Geom$use_defaults() handle populating legend keys with defaults.

The legend code was mirroring Layer$compute_geom_2() in many ways anyway, so this shouldn't be much of a stretch. This ensures that the layer could impose some of its non-aesthetic parameters on the legend keys. That is needed to resolve the defaults for the correct legend type in geom_sf(), which we'd need for #5833.

In addition the following changes are made: