r - 如何在plotly中为3D绘图的轴标签添加上标或下标?

标签 r plot plotly

如何在plotly中为3D绘图的轴标签添加上标或下标?

我尝试使用 bquote ,但它没有用。谷歌搜索也没有给这个问题带来太多。

清除代码:

library(plotly)
set.seed(123)

n <- 100
theta <- runif(n, 0, 2*pi)
u <- runif(n, -1, 1)


base<-'B1'
compare<-'A1'
plot (1, 1, main = bquote('Annual mean' ~CO[2] ~'Flux Difference: \n'  ~.(compare)~ 'minus'~.(base)))


p <- plot_ly(x = ~sqrt(1 - u^2) * cos(theta), y = ~sqrt(1 - u^2) * sin(theta), z = ~u) %>%
  layout(
    title = "Layout options in a 3d scatter plot",
    scene = list(
      xaxis = list(title = bquote('Annual mean' ~CO[2] ~'Flux Difference: \n'  ~.(compare)~ 'minus'~.(base))),
      yaxis = list(title = "Sin"),
      zaxis = list(title = "Z")
    ))
p

感谢您的时间!

最佳答案

使用 HTML 标签,例如:

yaxis = list(title = "Sin<sup>super</sup>")

更多信息 here .希望这可以帮助!

enter image description here

关于r - 如何在plotly中为3D绘图的轴标签添加上标或下标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45282464/

相关文章:

r - ggplot2 在使用 scale_x_sqrt 时删除零

r - 根据名称类型将 data.frame 的列加在一起

python - 如何使用 Plotly 绘制循环的局部变量

python - 痕迹未显现

python - 在 Plotly Python 中更改子图标题位置/方向

r - 如何查找向量是R中的列向量还是行向量

r - 如何用R中的线性模型单独替换NA

r - 在 facet_grid ggplot : x-axis labels differ per row 上强制 x 轴标签

matlab - 尝试使用 MATLAB 绘制 z = x + y 时图形不正确

python - 将图例添加到 matplotlib 箱线图中,在同一轴上有多个图