你没有提供你的数据,所以我不能准确地测试你的问题,
但我认为下面的示例将帮助您解决问题。
我认为您的问题源于包含参数inset = -0.25。
那就是将图例移出显示区域。看着你的照片,
我认为你这样做的原因是因为否则
图例覆盖了散点图的一部分。解决此问题的另一种方法是使用windowRect 调整绘图区域以允许更多空间。
像你这样的情节,传说被砍掉了。
scatter3d(x = iris[,1], y = iris[,2], z = iris[,3], groups = iris[,5],
surface.col = rainbow(3), grid = FALSE, surface = FALSE)
legend3d("right", legend = levels(iris[,5]),
col = rainbow(3), inset = -0.25, pch = 16, xpd = TRUE)
没有缩进的第二个情节。现在图例与情节重叠。
scatter3d(x = iris[,1], y = iris[,2], z = iris[,3], groups = iris[,5],
surface.col = rainbow(3), grid = FALSE, surface = FALSE)
legend3d("right", legend = levels(iris[,5]),
col = rainbow(3), pch = 16, xpd = TRUE)
最后,调整窗口大小,为图例留出更多空间。
par3d(windowRect = c(100, 100, 600, 350))
scatter3d(x = iris[,1], y = iris[,2], z = iris[,3], groups = iris[,5],
surface.col = rainbow(3), grid = FALSE, surface = FALSE)
legend3d("right", legend = levels(iris[,5]),
col = rainbow(3), pch = 16, xpd = TRUE)
您可能需要针对您的数据以不同方式调整windowRec,但此设置将是一个很好的起点。