我是R的新手,所以请容忍我,即使这个问题对你来说有点傻。
我想在rgl图上画一个图例,描绘颜色的含义(即图上的彩色球体对应的数字)。下面是我构建它的代码:
plot3d(t$x,t$y,t$z,col=colors,type = 's', size=4,
xlim=8, ylim=8, zlim=8, image=TRUE, legend=TRUE, lty=1, cex=0.5)我在网上到处都找遍了,但我还是找不到如何在“RGL”剧情上添加一个传奇故事。到处都是关于如何在使用'plot;函数的图形包绘制的图形上添加图例。另外,我也尝试过这个(除了上面的代码):
plot3d(t$x,t$y,t$z,col=colors,type = 's', size=4,xlim=8,ylim=8,zlim=8)
legend(100,100,c("Zero",
"Between 1 and 10","Between 10 and 25",
"Between 25 and 50","Between 50 and 70",
"More than 70","Other"),
lty=c(l,l,l,l,l,l,l), lwd=c(2.5,2.5,2.5,2.5,2.5,2.5,2.5),
col=c("White", "Red", "Orange", "Yellow", "Green", "Blue", "Magenta"))我得到了以下输出:Error in strwidth(legend, units = "user", cex = cex, font = text.font) : plot.new has not been called yet
请教我怎么做。提前谢谢你..
发布于 2015-07-14 04:45:23
可以使用legend3d()将图例添加到rgl打印。
https://stackoverflow.com/questions/24575727
复制相似问题