Adding a scatter3d-type to a subplot


Is there a way to add a scatter3d-type plot to a subplot? I’ve tried the subplot() function, but either the scatter3d-plot was displayed like a background image

or an empty space was added to the upper panel.

Thanks for any tips.

Hi there,
You’ll have to update domain in the scene() attribute of the layout() like this:


p1 = plot_ly(x = 1, y = 1)
p2 = plot_ly(x = 1, y = 1, z = 1, type = “scatter3d”)
subplot(p1, p2) %>% layout(scene = list(domain = list(x = c(0.5, 1), y = c(0,1))))

Thanks for bringing this up, we’ll add a 3D/2D subplot example to our documentation!

Hey Chelsea,

Thanks a lot!