8000 Fixes/workaround for upcoming (> v3.4.3) ggplot2 release by cpsievert · Pull Request #2301 · plotly/plotly.R · GitHub
[go: up one dir, main page]

Skip to content

Fixes/workaround for upcoming (> v3.4.3) ggplot2 release #2301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 11, 2023
Merged
Changes from 1 commit
Commits
File filter
8000

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
Prev Previous commit
Next Next commit
Quick and dirty fix proposal for tidyverse/ggplot2#5428
  • Loading branch information
cpsievert committed Oct 6, 2023
commit 922bea41b366e41e6f8ddc3e91906316da1c204b
10 changes: 9 additions & 1 deletion R/ggplotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,15 @@ scales_add_missing <- function(plot, aesthetics) {
# towards ggproto methods attached to `plot$guides`
# -------------------------------------------------------------------------
get_gdefs_ggproto <- function(scales, theme, plot, layers) {
guides <- plot$guides$setup(scales)

# Proposed change to accomodate
# https://github.com/tidyverse/ggplot2/pull/5428
# Ensure a 1:1 mapping between aesthetics and scales
aesthetics <- lapply(scales, `[[`, "aesthetics")
scales <- rep.int(scales, lengths(aesthetics))
aesthetics <- unlist(aesthetics, recursive = FALSE, use.names = FALSE)

guides <- plot$guides$setup(scales, aesthetics = aesthetics)
guides$train(scales, theme$legend.direction, plot$labels)
if (length(guides$guides) > 0) {
guides$merge()
Expand Down
0