plotly.R
plotly.R copied to clipboard
`ggplot2::geom_rect` not passed to in `ggplotly`
ggplot2::geom_rect isn't used in ggplotly:
library(dplyr)
library(ggplot2)
library(plotly)
g <- ggplot(starwars,
aes(x = height, y = mass)) +
geom_rect(data = starwars |> filter(sex == "male"),
aes(fill = sex), xmin = -Inf, xmax = Inf,
ymin = -Inf, ymax = Inf, alpha = 0.3) +
geom_point(shape = 1) +
facet_grid(sex ~ gender)
g
ggplotly(g)
I have a successful try,you can try it.
`g <- ggplot(starwars,
aes(x = height, y = mass)) +
geom_rect(data = starwars |> filter(sex == "male"),
aes(fill = sex), xmin = 0, xmax = 500,
ymin = 0, ymax = 2000, alpha = 0.3) +
geom_point(shape = 1) +
facet_grid(sex ~ gender)
g
ggplotly(g)`