R 中的 scatter3D 与平面的着色问题

发布于 2025-01-16 03:01:15 字数 617 浏览 3 评论 0原文

我正在使用 plot3D 库中的 scatter3D 并用预测平面绘制散点图:

library(plot3D)   
scatter3D(x1,x2,y, bty = "g",
              pch = 20, cex = 2, ticktype = "detailed",
              surf = list(x = sort(unique(x1_new)), y = sort(unique(x2_new)), z = z.pred ,  
                          facets = NA
                          ))

但是,我的 y 范围从 -1 到 1 ,z.pred 中的一些预测低于 -1。因此,您会注意到低于 -1 的预测没有着色,因为它们超出了色标。我该如何解决这个问题?

输入图片此处描述

I am using a scatter3D from the library plot3D and plotting a scatterplot with a plane of predictions:

library(plot3D)   
scatter3D(x1,x2,y, bty = "g",
              pch = 20, cex = 2, ticktype = "detailed",
              surf = list(x = sort(unique(x1_new)), y = sort(unique(x2_new)), z = z.pred ,  
                          facets = NA
                          ))

my y ranges from -1 to 1, however, some predictions in z.pred are lower than -1. Hence you will notice that predictions below -1 are not coloured as they are outside the colour scale. How can I fix that?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

作死小能手 2025-01-23 03:01:15

试试这个:

library(plot3D)   
scatter3D(x1,x2,y, bty = "g",
              pch = 20, cex = 2, ticktype = "detailed",
              surf = list(x = sort(unique(x1_new)), y = sort(unique(x2_new)), z = z.pred ,  
                          facets = NA
                          ),clim=c(min(y,z.pred),max(y,z.pred))

Try this:

library(plot3D)   
scatter3D(x1,x2,y, bty = "g",
              pch = 20, cex = 2, ticktype = "detailed",
              surf = list(x = sort(unique(x1_new)), y = sort(unique(x2_new)), z = z.pred ,  
                          facets = NA
                          ),clim=c(min(y,z.pred),max(y,z.pred))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文