Paul Govan
Paul Govan

Reputation: 703

3D Bubble Chart in R Plotly

I am struggling with developing a 3D bubble chart in R plotly. Plotly has a nice tutorial in python, but I have been unable to replicate in R.

library(plotly)
plot_ly(mtcars, x=mpg, y=cyl, z=disp, type='scatter3d', mode='markers',
        marker=list(sizemode='diameter', sizeref=750, size=hp, color=drat, 
                    colorscale = 'Viridis'))

Upvotes: 3

Views: 3134

Answers (1)

Paul Govan
Paul Govan

Reputation: 703

library(plotly)
plot_ly(mtcars, x=mpg, y=cyl, z=disp, type='scatter3d', mode='markers',
        sizemode='diameter', size=hp, color=drat, colorscale = 'Viridis')

enter image description here

Upvotes: 5

Related Questions