config: Set the default configuration for plotly

Description Usage Arguments Author(s) Examples

View source: R/layout.R

Description

Set the default configuration for plotly

Usage

1
2
config(p, ..., cloud = FALSE, showSendToCloud = cloud, locale = NULL,
  mathjax = NULL)

Arguments

p

a plotly object

...

these arguments are documented at https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js

cloud

deprecated. Use showSendToCloud instead.

showSendToCloud

include the send data to cloud button?

locale

locale to use. See here for more info.

mathjax

add MathJax rendering support. If "cdn", mathjax is loaded externally (meaning an internet connection is needed for TeX rendering). If "local", the PLOTLY_MATHJAX_PATH environment variable must be set to the location (a local file path) of MathJax. IMPORTANT: plotly uses SVG-based mathjax rendering which doesn't play nicely with HTML-based rendering (e.g., rmarkdown documents and shiny apps). To leverage both types of rendering, you must <iframe> your plotly graph(s) into the larger document (see here for an rmarkdown example and here for a shiny example).

Author(s)

Carson Sievert

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# remove the plotly logo and collaborate button from modebar
config(plot_ly(), displaylogo = FALSE, collaborate = FALSE)

# enable mathjax
# see more examples at https://plot.ly/r/LaTeX/
plot_ly(x = c(1, 2, 3, 4), y = c(1, 4, 9, 16)) %>%
  layout(title = TeX("\\text{Some mathjax: }\\alpha+\\beta x")) %>%
  config(mathjax = "cdn")

# change the language used to render date axes and on-graph text 
# (e.g., modebar buttons)
today <- Sys.Date()
x <- seq.Date(today, today + 360, by = "day")
p <- plot_ly(x = x, y = rnorm(length(x))) %>%
  add_lines()

# japanese
config(p, locale = "ja")
# german
config(p, locale = "de")
# spanish
config(p, locale = "es")
# chinese
config(p, locale = "zh-CN")

plotly documentation built on Nov. 8, 2019, 1:07 a.m.