Skip to contents

Applies common layout configuration to a Plotly chart.

Usage

plotly_layout(
  p,
  font = list(color = pal::pkg_config_val("plot_color_body"), family =
    pal::pkg_config_val("font_family_body")),
  paper_bgcolor = pal::pkg_config_val("plot_color_bg"),
  plot_bgcolor = paper_bgcolor,
  xaxis = list(gridcolor = pal::pkg_config_val("plot_color_grid")),
  yaxis = list(gridcolor = pal::pkg_config_val("plot_color_grid")),
  ...
)

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

X-axis configuration.

yaxis

Y-axis configuration.

...

Further layout configuration arguments.

Value

A plotly object.

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")))