你能推荐一种方法来可视化R中的数据集,就像在一种晶格包(点云可视化)中一样,但在点浓度较高的部分具有变化的颜色?例如,如果在坐标等于0:-1:6的距离10上有一个没有邻居的点,那么这个点将被涂成蓝色。当有一个点有很多近邻的coordianate为100:100:100 (而邻居是99:100:100)时,这个点将是红色的。
此外,还需要能够在3D中生成这样的可视化效果。
有这样的解决方案吗?
示例:
x = (sample.int(101,size=100,replace=TRUE)-1)/100
y = (sample.int(101,size=100,replace=TRUE)-1)/100
z = (sample.int(101,size=100,replace=TRUE)-1)/100
data = data.frame(x,y,z)然后我想用plot.ly开发一些东西,例如
library(plotly)
plot_ly(type = 'scatter3d', x = x, y = y, z = z, mode = "markers")这提供了一个很好的结果,但我想要更多的可视化,特别是在颜色。有解决方案吗?
发布于 2016-11-25 10:05:36
有几种方法可以做到这一点。您可以根据距定义中心的距离定义自己的方法,或者使用聚类方法。
例如,使用kmeans集群:
set.seed(20)
dataCluster <- kmeans(data, 5, nstart = 20)$cluster %>%
as.factor()
plot_ly(type = 'scatter3d', x = x, y = y, z = z, mode = "markers", color = dataCluster)https://stackoverflow.com/questions/40567519
复制相似问题