Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# plotly (development version)

## Improvements

* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.4). (#2315)

# 4.10.3

## Improvements
Expand Down
8 changes: 4 additions & 4 deletions R/ggplotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ gg2list <- function(p, width = NULL, height = NULL,
theme$legend.box.just <- theme$legend.box.just %||% c("center", "center")
# scales -> data for guides
gdefs <- if (inherits(plot$guides, "ggproto")) {
get_gdefs_ggproto(npscales$scales, theme, plot, layers)
get_gdefs_ggproto(npscales$scales, theme, plot, layers, data)
} else {
get_gdefs(scales, theme, plot, layers)
}
Expand Down Expand Up @@ -1511,7 +1511,7 @@ scales_add_missing <- function(plot, aesthetics) {
# which away from guides_train(), guides_merge(), guides_geom()
# towards ggproto methods attached to `plot$guides`
# -------------------------------------------------------------------------
get_gdefs_ggproto <- function(scales, theme, plot, layers) {
get_gdefs_ggproto <- function(scales, theme, plot, layers, layer_data) {

# Unfortunate duplication of logic in tidyverse/ggplot2#5428
# which ensures a 1:1 mapping between aesthetics and scales
Expand All @@ -1520,10 +1520,10 @@ get_gdefs_ggproto <- function(scales, theme, plot, layers) {
aesthetics <- unlist(aesthetics, recursive = FALSE, use.names = FALSE)

guides <- plot$guides$setup(scales, aesthetics = aesthetics)
guides$train(scales, theme$legend.direction, plot$labels)
guides$train(scales, plot$labels)
if (length(guides$guides) > 0) {
guides$merge()
guides$process_layers(layers)
guides$process_layers(layers, layer_data)
}
# Add old legend/colorbar classes to guide params so that ggplotly() code
# can continue to work the same way it always has
Expand Down