Re: [问题] scatterplot3d 立体散布图"标点"

楼主: tai34 (tai)   2014-05-09 18:17:20
※ 引述《tai34 (tai)》之铭言:
: 程式咨询(我想用R 做某件事情,但是我不知道要怎么用R 写出来)
: [软件熟悉度]:
: 入门(写过其他程式,只是对语法不熟悉)
: [问题叙述]:
: 各位先进好:
: 小弟我用pca分析我的资料,想用PC1,PC2,PC3画3D散布图之后做进一步的分析。
: 假设资料如下:
: w PC1 PC2 PC3
: 1 2 3 7
: 2 5 4 8
: 3 6 9 10
: 指令如下:
: scatterplot3d(PC1,PC2,PC3, pch=16,
: type="h", bio=par("bio"), bg=par("bg"), main="3D Scatterplot")
: 3D散布图画出来了,但是我想要把散布立体图上每一个点加上w做标记,
: 请问我的指令要补充什么?
: 谢谢
小弟在搜寻一下午找到答案,所以来自问自答一下。
library(scatterplot3d)
with(pca, {
s3d <- scatterplot3d(PCA1, PC2, PC3, # x y and z axis
color="blue", pch=19, # filled blue circles
type="h", # vertical lines to the x-yplane
main="3-D Scatterplot Example 3",
s3d.coords <- s3d$xyz.convert(PC1, PC2, PC3)
# convert 3D coords to 2D projection
text(s3d.coords$x, s3d.coords$y, # x and y coordinates
labels=row.names(pca), # text to plot
cex=.5, pos=4) # shrink text 50% and place to right of points)
})
顺便提供网址,如果有人需要可以参考一下。
http://ppt.cc/FoK~
作者: Wush978 (拒看低质媒体)   2014-05-09 18:54:00
谢谢分享

Links booklink

Contact Us: admin [ a t ] ucptt.com