Closed
Description
I had exactly the same issue as described in #5892. After updating the plotly
package to version 4.10.4 most of my plots worked well.
However, in the follwing situation ggplotly
does not work properly.
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)
For the second plot (g2), when using ggplotly I get the following error:
Error in `[.data.frame`(decor, c("value", "colour")) :
undefined columns selected
sessionInfo:
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_Switzerland.utf8 LC_CTYPE=English_Switzerland.utf8
[3] LC_MONETARY=English_Switzerland.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Switzerland.utf8
time zone: Europe/Zurich
tzcode source: internal
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] plotly_4.10.4 ggplot2_3.5.1
The example above works in the following session:
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_Switzerland.utf8 LC_CTYPE=English_Switzerland.utf8
[3] LC_MONETARY=English_Switzerland.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Switzerland.utf8
time zone: Europe/Zurich
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] plotly_4.10.3 ggplot2_3.4.4
Ursprünglich gepostet von @thgsponer in tidyverse/ggplot2#5926
Metadata
Metadata
Assignees
Labels
No labels