R绘制3D散点图

目前主要使用ggplot2做一些数据可视化的分析,但是ggplot2有个很大的缺陷是不支持3D作图,所以需要查找其他替代方案。

下面找到的两个替代方案不错,亲测可行,记录于此。

 

交互3D

library(rgl)
with(mtcars,{
    plot3d(wt, disp, mpg, col="red", size=3)
})

效果图R动态3D

 

静态3D

library(scatterplot3d)
with(mtcars,{
    scatterplot3d(wt,   # x-axis
                  disp, # y-axis
                  mpg,  # z-axis
                  main="3D Scatterplot")
})

效果图

 

参考资料:http://www.statmethods.net/graphs/scatterplot.html

 

posted @ 2014-08-17 15:59  bourneli  阅读(7327)  评论(0编辑  收藏  举报