gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 11:35:24 27 4
gpt4 key购买 nike

如何在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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com