Skip to content

plotly isn't working with scale_fill_binned #2403

Open
@darcey-s

Description

Same issue as #2357 and #5926. Same minimal reproducible example still throws up the errors:
Warning in min(x, na.rm = na.rm) :
no non-missing arguments to min; returning Inf
Warning in max(x, na.rm = na.rm) :
no non-missing arguments to max; returning -Inf
Warning: Error in [.data.frame: undefined columns selected

library(ggplot2)
library(plotly)

xy_grid <- expand.grid(ps=seq(-1,3, length=100),
trs=seq(-1,3,length=100))
xy_grid$ptl <- xy_grid$ps^2 + xy_grid$trs^2

theme_set(theme_bw())
g1 <- ggplot(xy_grid) +
geom_raster(aes(y=ps,x=trs,fill=ptl), interpolate = TRUE) +
geom_contour(aes(y=ps,x=trs,z=ptl), breaks = c(2,4,6,8,10), color='black')

this works
ggplotly(g1)

adding scale_fill_binned
g2 <- g1 + scale_fill_binned(low = 'red', high = 'green', breaks = c(2,4,6,8,10))

this does not work
ggplotly(g2)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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