Skip to content

Commit 453b10e

Browse files
Solved the LaTeX2exp error. Closes plotly#2027
1 parent 6186822 commit 453b10e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

R/ggplotly.R

+11-1
Original file line numberDiff line numberDiff line change
@@ -1300,14 +1300,24 @@ faced <- function(txt, face = "plain") {
13001300
bold <- function(x) paste("<b>", x, "</b>")
13011301
italic <- function(x) paste("<i>", x, "</i>")
13021302

1303+
# generic S3 method to allow for class specific implementations
1304+
uniq <- function(x){
1305+
UseMethod("uniq", x)
1306+
}
1307+
13031308
# if a vector that has one unique value (ignoring missings), return that value
1304-
uniq <- function(x) {
1309+
uniq.default <- function(x) {
13051310
u <- unique(x)
13061311
if (identical(u, NA) || length(u) == 0) return(u)
13071312
u <- u[!is.na(u)]
13081313
if (length(u) == 1) u else x
13091314
}
13101315

1316+
# if TeX object convert to character first
1317+
uniq.TeX <- function(x){
1318+
print(uniq.default(as.character(x)))
1319+
}
1320+
13111321
# theme(strip.background) -> plotly.js rect shape
13121322
make_strip_rect <- function(xdom, ydom, theme, side = "top") {
13131323
rekt <- rect2shape(theme[["strip.background"]])

0 commit comments

Comments
 (0)