Skip to content

Commit 8cc9b91

Browse files
committed
fix bug; document
1 parent 33d7e68 commit 8cc9b91

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

R/layout.R

+13-5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
9191
#' @param collaborate include the collaborate mode bar button (unique to the R pkg)?
9292
#' @param cloud include the send data to cloud button?
9393
#' @param locale locale to use. See [here](https://github.com/plotly/plotly.js/tree/master/dist#to-include-localization) for more info.
94+
#' @param mathjax whether or not to add [MathJax rendering support](https://github.com/plotly/plotly.js/tree/master/dist#to-support-mathjax).
95+
#' Note that plotly uses SVG-based mathjax rendering which won't play nicely with
96+
#' HTML-based rendering (e.g., rmarkdown documents). In this case, you may want to
97+
#' consider `<iframe>`-ing your plotly graph(s) into the larger document.
98+
#' Currently mathjax is loaded externally (meaning an internet
99+
#' connection is needed to view the graph). Future versions may not have this requirement.
94100
#' @author Carson Sievert
95101
#' @export
96102
#' @examples
@@ -103,16 +109,18 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
103109
#' # remove the plotly logo and collaborate button from modebar
104110
#' config(p, displaylogo = FALSE, collaborate = FALSE)
105111
#'
112+
#' # enable mathjax
113+
#' # see more examples at https://plot.ly/r/LaTeX/
114+
#' plot_ly(x = c(1, 2, 3, 4), y = c(1, 4, 9, 16)) %>%
115+
#' layout(title = "$\\text{Some mathjax: }\\alpha+\\beta x$") %>%
116+
#' config(mathjax = TRUE)
117+
#'
106118
#' # japanese
107119
#' config(p, locale = "ja")
108120
#' # german
109121
#' config(p, locale = "de")
110-
#' # swiss-german
111-
#' config(p, locale = "de-CH")
112122
#' # spanish
113123
#' config(p, locale = "es")
114-
#' # french
115-
#' config(p, locale = "fr")
116124
#' # chinese
117125
#' config(p, locale = "zh-CN")
118126
#'
@@ -129,7 +137,7 @@ config <- function(p, ..., collaborate = TRUE, cloud = FALSE, locale = NULL, mat
129137

130138
if (!identical(mathjax, FALSE)) {
131139
p$dependencies <- c(
132-
list(mathjax_dependency()),
140+
list(mathjax_cdn()),
133141
p$dependencies
134142
)
135143
}

man/config.Rd

+15-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)