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?
CodePudding user response:
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))