Skip to contents

Transform a ggplot2/plot2 object to an interactive plot using the Plotly R Open Source Graphing Library.

Usage

as_plotly(plot, ...)

plotly_style(plot, ...)

Arguments

plot

a ggplot2 plot

...

In case of as_plotly(): arguments to pass on to layout() to change the Plotly layout object

In case of plotly_style(): arguments to pass on to style() to change the Plotly style object

Examples

mtcars |>
  plot2(mpg, hp) |> 
  as_plotly()
#> i Using type = "point" since both axes are numeric
mtcars |> plot2(mpg, hp) |> as_plotly(dragmode = "pan") |> plotly_style(marker.line.color = "red", hoverinfo = "y") #> i Using type = "point" since both axes are numeric