Skip to contents

Applies custom width and height to a Plotly figure, ensuring the plot displays at the specified dimensions. The function also sets the plot to autosize for responsive layouts.

Usage

ro_ply_dim(fig, width = 776, height = 400)

Arguments

fig

A Plotly figure object created by plotly::plot_ly() or similar.

width

Desired plot width in pixels. Default is 776.

height

Desired plot height in pixels. Default is 400.

Value

A Plotly figure object with updated sizing policy and layout.

Examples

if (FALSE) { # \dontrun{
fig <- plotly::plot_ly(data = mtcars, x = ~mpg, y = ~hp, type = 'scatter', mode = 'markers')
fig_dimmed <- ro_ply_dim(fig, width = 800, height = 500)
fig_dimmed
} # }