plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

`ggplot2::geom_rect` not passed to in `ggplotly`

Open ocelhay opened this issue 3 years ago • 1 comments

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)
Screenshot 2022-10-25 at 09 41 40 Screenshot 2022-10-25 at 09 41 55

ocelhay avatar Oct 25 '22 16:10 ocelhay

I have a successful try,you can try it. image image `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)`

hulaoda000 avatar May 23 '23 01:05 hulaoda000