Skip to content

Navigation Menu

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

Appearance settings

Error in match.fun(FUN): 'ggfun("scales_transform_df")' is not a function, character or symbol #2259

Copy link
Copy link
Closed
@tungttnguyen

Description

@tungttnguyen
Issue body actions

FYI, future changes in ggplot2 will break ggplotly(). The following example did not work with the development version of ggplot2.
See also this discussion

library(dplyr)
library(ggplot2)
packageVersion("ggplot2")
#> [1] '3.4.2.9000'

data("airquality")

airquality <- airquality %>% 
  select(Month, Day, Temp) %>% 
  mutate(Date = as.Date(paste("1973", Month, Day, sep = "-")))

plt1 <- ggplot(airquality,
               aes(x = Date,
                   y = Temp)) +
  geom_line() +
  theme_bw()
library(plotly)
packageVersion("plotly")
#> [1] '4.10.1'

ggplotly(plt1, 
         tooltip = c("x", "y", "color", "text"),
         dynamicTicks = TRUE) %>% 
  rangeslider() %>%
  layout(
    legend = list(orientation = "h", x = 0.1, y = -0.5)
  )
#> Error in match.fun(FUN): 'ggfun("scales_transform_df")' is not a function, character or symbol

https://github.com/plotly/plotly.R/blob/master/R/ggplotly.R#L317

# Transform all scales
data <- lapply(data, ggfun("scales_transform_df"), scales = scales)

https://github.com/plotly/plotly.R/blob/master/R/ggplotly.R#L1391-L1395

# We need access to internal ggplot2 functions in several places
# this helps us import functions in a way that R CMD check won't cry about
ggfun <- function(x) {
  tryCatch(getFromNamespace(x, "ggplot2"), error = function(e) NULL)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.