I have below plot using plotly
library(plotly)
set.seed(1)
n <- 100
theta <- runif(n, 0, 2*pi)
u <- runif(n, -1, 1)
base<-'B1'
compare<-'A1'
p <- plot_ly(x = ~sqrt(1 - u^2) * cos(theta), y = ~sqrt(1 - u^2) * sin(theta), z = ~u) %>%
layout(
title = "Some plot",
scene = list(
yaxis = list(title = expression('theta'))
))
p
I wanted to add greek expression theta
in the y-axis title, and tried using expression(theta)
, however it is not rendering.
Could you please find how is it possible to add greek letters in plotly
?
One option would be to use UTF-8 codes, e.g. "\u03B8"
for a theta
library(plotly)
set.seed(1)
n <- 100
theta <- runif(n, 0, 2*pi)
u <- runif(n, -1, 1)
base<-'B1'
compare<-'A1'
p <- plot_ly(x = ~sqrt(1 - u^2) * cos(theta), y = ~sqrt(1 - u^2) * sin(theta), z = ~u) %>%
layout(
title = "Some plot",
scene = list(
xaxis = list(title = list(text = "\u03B8")),
yaxis = list(title = "Y-axis")
))
p