Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Defined axes with limits

Dear community,

In this code, I would like to add an option to delimited axis like with this option in usual function “plot”: xlim=c(-4, 4), ylim=c(-4, 4).

a<-rnorm(10)
b<-rnorm(10)
c<-rnorm(10)

p <- plot_ly()
p <- add_trace(p, x=a, y=b, z=c, mode="markers", type="scatter3d", marker = list(size = 5, color = 'rgba(0, 0, 0, 1)'))
p <- layout(p, scene = list(xaxis = list(title = "A"), yaxis = list(title = "B"), zaxis = list(title = "C")))
p

Many thanks in advance,

Alex

hey @Aleksik

Are you looking for range = c(-4,4)

p <- layout(p, scene = list(xaxis = list(title = "A", range = c(-4,4)), yaxis = list(title = "B", range = c(-4,4)), zaxis = list(title = "C")))

1 Like

Thank you bcd, it works.