我正在使用rgl包在R中绘制一个3D散点图。一切正常,除了3D图上没有出现的图例,我有这个警告:
Warning messages:
1: In rgl.material(color = color, back = back, ...) :
RGL: Pixmap load: file format unsupported
2: In rgl.material(color = color, back = back, ...) :
RGL: Pixmap load: failed
命令行的例子:
#if needed: install.packages("rgl")
library(rgl)
pca<-data.frame(replicate(10,sample(0:50,1000,rep=TRUE)))
mygroups <- as.factor(pca$X10)
acp3d<-function(pca, comp=1:3, group=mygroups, plotVars = FALSE,
pointSize=2, plotText=FALSE){
x<-pca
hashCol<-rainbow(nlevels(group))
names(hashCol)<-levels(group)
colors<-hashCol[group]
percentVar <- pca$percentVar
plot3d(x[,comp[1]],x[,comp[2]],x[,comp[3]],
xlab=paste0("PC",comp[1],": ",round(percentVar[comp[1]] * 100),"% variance"),
ylab=paste0("PC",comp[2],": ",round(percentVar[comp[2]] * 100),"% variance"),
zlab=paste0("PC",comp[3],": ",round(percentVar[comp[3]] * 100),"% variance"),
col=colors,size=5,type=ifelse(plotText,"n","p"),box = FALSE)
legend3d("topright", legend = names(hashCol), pch = 16, col = hashCol, cex=1, inset=c(0.02))
}
acp3d(pca)
有人遇到了与我相同的问题(Doesn't work legend3d function in the newest version of the rgl package),所以我尝试按照推荐的方式安装zlib。我下载了zlib-1.2.11并将文件夹放在C:\ Program Files \ R \ R-3.4.1 \ library中,但它没有解决我的问题。 我还通过biocLite安装了zlibbioc,但也没有改进。 根据答案的推荐,我也查看了C:/ Program Files / R / R-3.4.1 / etc / x64 / Makeconf,但我发现zlib的唯一内容是:
## For use in packages
GRAPHAPP_LIB = -lRgraphapp
TCL_VERSION = 86
# was a reference to Rzlib.dll in R < 3.2.0
ZLIB_LIBS = -lz
我不明白这意味着什么(我不是计算机专家)。我甚至不确定zlib是否是问题因为我在安装rgl时没有关于zlib的警告。
有想法制作传奇吗?感谢
R version 3.4.1(2017-06-30) - &#34; Single Candle&#34; 平台:x86_64-w64-mingw32 / x64(64位) install.packages(&#34; RGL&#34)