简体   繁体   English

R:具有悬浮信息的交互式3D绘图散点图RGB样式

[英]R: Interactive 3D plotly scatterplot rgl-style with hover info

I'm using plotly to draw an interactive 3D scatter plot with spheres, eg: 我正在使用plotly绘制带有球体的交互式3D散点图,例如:

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'))

在此处输入图片说明

The problem is: I hate plotly's spheres. 问题是:我讨厌情节的领域。 I much prefer rgl 's spheres which have a "shine" effect to them, eg: 我更喜欢rgl的球,它们对它们具有“发光”效果,例如:

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

在此处输入图片说明

And I think there's even a way in which rgl objects can be embedded in web page like plotly objects. 而且我认为,甚至有一种方法可以像绘制对象一样将rgl对象嵌入网页中。 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? 有没有办法让我的绘图球体具有“光泽”效果,并且看起来更像rgl的球体? Or a way to make rgl plots have some of plotly's features especially hove info? 还是一种使rgl图具有某些plotly功能的方法,尤其是偏爱信息?

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. 对于许多Javascript编程,这应该是可能的,因为将rgl嵌入到网页中后,它rgl Javascript用于所有内容。 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). 在R(使用Windows或X11显示场景,而不是浏览器),它可能更难,但select3didentify3d功能做相关的东西(虽然不是事件驱动)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM