r - 使用 R/plotly 在轴标题中写入符号摄氏度

标签 r plotly

我试图在我的一个标题中用 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/

相关文章:

r - 更改 rCharts 桑基图上的字体大小

R - 基于日期列使用 group_by 进行平均计算?

javascript - 从 plotly 的任何地方 plotly 地点击事件

r - 更改绘图图表中的图例大小

Python/plotly : How to extract 'm' and 'b' from OLS line?

r - plotly R : change hoverinfo font color according to different bar colors

python - 如何访问用户未明确设置的图形属性

r - sparklyr 与 Kerberos 的联系

R 条形图轴缩放

r - 将列名和行名与另一个数据框中的列名和值进行匹配