Controlling the axis title font size in plotly

Viewed 1273

Any idea how to control the font size of an axis title in R plotly?

Starting with this example:

library(plotly)

A <- B <- seq(-5, 5, by = 0.2)
z <- outer(A, B, function(x,y) exp(-x^2-y^2))

plot_ly(x = A, y = B, z = z) %>% add_surface() %>%
  layout(scene = list(xaxis = list(title = "A"), yaxis = list(title = "B")))

I tried:

plot_ly(x = A, y = B, z = z) %>% add_surface() %>%
  layout(scene = list(xaxis = list(title = "A",font = list(size = 10)), yaxis = list(title = "B")))

But there's no difference and neither titlefont = list(size = 10) makes any difference.

Thanks

1 Answers
library(plotly)

A <- B <- seq(-5, 5, by = 0.2)
z <- outer(A, B, function(x,y) exp(-x^2-y^2))

plot_ly(x = A, y = B, z = z) %>% add_surface() %>%
  layout(scene = list(xaxis = list(title = "A",titlefont = list(size = 10)), yaxis = list(title = "B")))
Related