0
votes

I'm using plotly to draw an interactive 3D scatter plot with spheres, e.g.:

df <- data.frame(x = c(1,3,5), y = c(1,3,5), z = c(1,3,5), size = c(1,3,5))

library(plotly)
plot_ly(df, type = "scatter3d", x = ~x, y = ~y, z = ~z, size = ~size,
    marker = list(symbol = 'circle', sizemode = 'diameter'))

enter image description here

The problem is: I hate plotly's spheres. I much prefer rgl's spheres which have a "shine" effect to them, e.g.:

library(rgl)
spheres3d(x = df$x, y = df$y, z = df$z, radius = 0.8 * sqrt(df$size))

enter image description here

And I think there's even a way in which rgl objects can be embedded in web page like plotly objects. However they lack the ability to present data on hover and other attractive capabilities of plotly.

Is there a way to get my plotly spheres to have a "shine" effect and look more like rgl's spheres? Or a way to make rgl plots have some of plotly's features especially hove info?

1

1 Answers

0
votes

This should be possible with a lot of Javascript programming, since when it's embedded in a web page, rgl is using Javascript for everything. However, there's no built-in support for reacting to mouse movements like that. Within R (using Windows or X11 to display the scene, not a browser) it's probably harder, but the select3d and identify3d functions do related things (though not event-driven).