Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d76e87e

Browse files
Updates for recent changes to ggplot2 ggproto guide API (#2315)
1 parent ee22264 commit d76e87e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎NEWS.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# plotly (development version)
22

3+
## Improvements
4+
5+
* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.4). (#2315)
6+
37
# 4.10.3
48

59
## Improvements

‎R/ggplotly.R‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /