@@ -1005,7 +1005,7 @@ gg2list <- function(p, width = NULL, height = NULL,
1005
1005
theme $ legend.box.just <- theme $ legend.box.just %|| % c(" center" , " center" )
1006
1006
# scales -> data for guides
1007
1007
gdefs <- if (inherits(plot $ guides , " ggproto" )) {
1008
- get_gdefs_ggproto(npscales $ scales , theme , plot , layers )
1008
+ get_gdefs_ggproto(npscales $ scales , theme , plot , layers , data )
1009
1009
} else {
1010
1010
get_gdefs(scales , theme , plot , layers )
1011
1011
}
@@ -1511,7 +1511,7 @@ scales_add_missing <- function(plot, aesthetics) {
1511
1511
# which away from guides_train(), guides_merge(), guides_geom()
1512
1512
# towards ggproto methods attached to `plot$guides`
1513
1513
# -------------------------------------------------------------------------
1514
- get_gdefs_ggproto <- function (scales , theme , plot , layers ) {
1514
+ get_gdefs_ggproto <- function (scales , theme , plot , layers , layer_data ) {
1515
1515
1516
1516
# Unfortunate duplication of logic in tidyverse/ggplot2#5428
1517
1517
# which ensures a 1:1 mapping between aesthetics and scales
@@ -1520,10 +1520,10 @@ get_gdefs_ggproto <- function(scales, theme, plot, layers) {
1520
1520
aesthetics <- unlist(aesthetics , recursive = FALSE , use.names = FALSE )
1521
1521
1522
1522
guides <- plot $ guides $ setup(scales , aesthetics = aesthetics )
1523
- guides $ train(scales , theme $ legend.direction , plot $ labels )
1523
+ guides $ train(scales , plot $ labels )
1524
1524
if (length(guides $ guides ) > 0 ) {
1525
1525
guides $ merge()
1526
- guides $ process_layers(layers )
1526
+ guides $ process_layers(layers , layer_data )
1527
1527
}
1528
1528
# Add old legend/colorbar classes to guide params so that ggplotly() code
1529
1529
# can continue to work the same way it always has
0 commit comments