目前主要使用ggplot2做一些數據可視化的分析,但是ggplot2有個很大的缺陷是不支持3D作圖,所以需要查找其他替代方案。
下面找到的兩個替代方案不錯,親測可行,記錄於此。
交互3D
library(rgl) with(mtcars,{ plot3d(wt, disp, mpg, col="red", size=3) })
效果圖
靜態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