plotly 3D surface, rename axis's title

Viewed 95

Below is the toy example I have attempted. Is anything wrong with it?

library(plotly)
fig <- plot_ly(z = ~volcano)
fig <- fig %>% add_surface() %>%
  layout(
    xaxis = list(title = 'N'), 
    yaxis = list(title = 'R')
  )

fig

Thanks for your time.

1 Answers

Try adding scene in layout:

library(plotly)

fig <- plot_ly(z = ~volcano)
fig <- fig %>% 
  add_surface() %>%
  layout(
    showlegend = F,
    scene = list(
      xaxis = list(title = 'N'), 
      yaxis = list(title = 'R')
    )
  )

fig

plotly 3d with axis labels

Related