Standard convert ggplot to plotly object
Arguments
- plot
Input ggplot object
- height
Height of interactive plot
- width
Width of interactive plot
- legend_opts
Legend styling option, a
list
containinglabel
,pos
(position) anddir
(direction).- axis_opts
Axis styling option. Default is a named list
list(xopts = list(showticklabels = TRUE, showline = TRUE, mirror = TRUE), yopts = list(showticklabels = TRUE, showline = TRUE, mirror = TRUE))
# nolint- hover
Tooltip aesthetic
Examples
library(ggplot2)
gplot <- adsl[1:100, ] |>
ggplot(aes(x = .data[["RACE"]], y = .data[["AGE"]], text = .data[["USUBJID"]])) +
geom_point()
as_plotly(
plot = gplot,
height = 400,
width = 400
)