When using plotly subplots (e.g., via split.by in dittoViz), axis styling
must be applied to all subplot axes (xaxis, xaxis2, xaxis3, etc.) individually.
This helper function detects how many subplots exist and applies the provided
axis styling to all of them.
Usage
apply_subplot_axis_styling(fig, xaxis_style, yaxis_style)
Arguments
- fig
A plotly figure object.
- xaxis_style
A named list of axis styling parameters for x-axes.
- yaxis_style
A named list of axis styling parameters for y-axes.
Value
The modified plotly figure with axis styling applied to all subplots.
Examples
fig <- plotly::plot_ly(mtcars, x = ~wt, y = ~mpg, type = "scatter", mode = "markers")
xaxis_style <- list(showline = TRUE, linecolor = "black", linewidth = 1)
yaxis_style <- list(showline = TRUE, linecolor = "black", linewidth = 1)
apply_subplot_axis_styling(fig, xaxis_style, yaxis_style)