Applies common layout configuration to a Plotly chart.
Usage
plotly_layout(
p,
font = list(color = pal::pkg_config_val(key = "plot_color_body", pkg = this_pkg),
family = pal::pkg_config_val(key = "font_family_body", pkg = this_pkg)),
paper_bgcolor = pal::pkg_config_val(key = "plot_color_bg", pkg = this_pkg),
plot_bgcolor = paper_bgcolor,
xaxis = list(gridcolor = pal::pkg_config_val(key = "plot_color_grid", pkg = this_pkg)),
yaxis = list(gridcolor = pal::pkg_config_val(key = "plot_color_grid", pkg = this_pkg)),
...
)
Arguments
- p
Plotly object to modify.
- font
Global font. Fonts used in traces and other layout components inherit from the global font.
- paper_bgcolor
Background color of the paper where the graph is drawn.
- plot_bgcolor
Background color of the plotting area in-between x and y axes.
- xaxis
- yaxis
- ...
Further layout configuration arguments.
See also
Other plot theming functions:
ggplot2_geom_defaults()
,
ggplot2_theme()
,
ggplot2_theme_html()
Examples
plotly::plot_ly(data = mtcars,
type = "bar",
x = ~mpg) |>
salim::plotly_layout(font = list(color = pal::pkg_config_val(key = "plot_color_body",
pkg = "salim")))