我试图在我的一个标题中用 R/Plotly 写符号摄氏度。当我只使用下面的简单绘图时,它就起作用了:
# Working code
library(latex2exp)
set.seed(1)
betas <- rnorm(1000)
hist(betas, main = TeX("Temperature (^0C)"))
但是,当我尝试通过 plotly 运行代码时,出现以下错误:“'HashTableSetup' 中未实现类型'表达式'”。
#Initialise the plot
p <- plot_ly()
#Add axis names
#Font
f <- list(
family = "Courier New, monospace",
size = 18,
color = "#7f7f7f")
#X axis name
x <- list(
title = "x Axis",
titlefont = f)
#Y Axis name
y <- list(
title = TeX("Temperature (^0C)"),
titlefont = f)
#Add layout
p <- p %>%
layout(xaxis = x, yaxis= y)
p
有任何想法吗?
最佳答案
尝试,
title = "Temperature (\u00B0C)"
关于r - 使用 R/plotly 在轴标题中写入符号摄氏度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51799118/