dreamRs / billboarder

:bar_chart: R Htmlwidget for billboard.js
https://dreamrs.github.io/billboarder/
Other
174 stars 21 forks source link

Scatterplot with region & custom tooltip #22

Closed rsangole closed 3 years ago

rsangole commented 4 years ago

Hello,

I'm wondering if it's possible to create a billboarder equivalent to this plot_ly plot:

library(plotly)

plotly::plot_ly(
  data = mtcars,
  x = ~ mpg,
  y = ~ disp,
  type = "scatter",
  color = ~ as.factor(cyl),
  hoverinfo = "text",
  hovertemplate = ~ glue::glue("<b>Cyl: {grp}</b>
                               mpg: {x}, disp: {y}", grp = cyl, x = mpg, y = disp)
) %>%
  plotly::layout(shapes = list(
    list(
      type = "rect",
      fillcolor = "red",
      line = list(color = "red"),
      opacity = 0.1,
      x0 = "10",
      x1 = "20",
      xref = "x",
      y0 = 30,
      y1 = 350,
      yref = "y"
    )
  ))
image
pvictor commented 4 years ago

Not currently I'm afraid... The rectangle annotation is not supported in main library, there's a plugin that should allow to do it but I've never used it...