@@ -1005,7 +1005,7 @@ gg2list <- function(p, width = NULL, height = NULL,
10051005 theme $ legend.box.just <- theme $ legend.box.just %|| % c(" center" , " center" )
10061006 # scales -> data for guides
10071007 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 )
10091009 } else {
10101010 get_gdefs(scales , theme , plot , layers )
10111011 }
@@ -1511,7 +1511,7 @@ scales_add_missing <- function(plot, aesthetics) {
15111511# which away from guides_train(), guides_merge(), guides_geom()
15121512# towards ggproto methods attached to `plot$guides`
15131513# -------------------------------------------------------------------------
1514- get_gdefs_ggproto <- function (scales , theme , plot , layers ) {
1514+ get_gdefs_ggproto <- function (scales , theme , plot , layers , layer_data ) {
15151515
15161516 # Unfortunate duplication of logic in tidyverse/ggplot2#5428
15171517 # which ensures a 1:1 mapping between aesthetics and scales
@@ -1520,10 +1520,10 @@ get_gdefs_ggproto <- function(scales, theme, plot, layers) {
15201520 aesthetics <- unlist(aesthetics , recursive = FALSE , use.names = FALSE )
15211521
15221522 guides <- plot $ guides $ setup(scales , aesthetics = aesthetics )
1523- guides $ train(scales , theme $ legend.direction , plot $ labels )
1523+ guides $ train(scales , plot $ labels )
15241524 if (length(guides $ guides ) > 0 ) {
15251525 guides $ merge()
1526- guides $ process_layers(layers )
1526+ guides $ process_layers(layers , layer_data )
15271527 }
15281528 # Add old legend/colorbar classes to guide params so that ggplotly() code
15291529 # can continue to work the same way it always has
0 commit comments