Skip to content
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

plotly isn't working with scale_fill_binned #2403

Open
darcey-s opened this issue Nov 27, 2024 · 0 comments
Open

plotly isn't working with scale_fill_binned #2403

darcey-s opened this issue Nov 27, 2024 · 0 comments

Comments

@darcey-s
Copy link

darcey-s commented Nov 27, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant