When I want to create a scatterplot matrix, there is a error about
Error in grid.Call.graphics(C_downviewport, name$name, strict) : Viewport 'plot_01.panel.1.1.off.vp' was not found".
How I can fix it?
varNum <- function(x){
val <- 1:ncol(x)
names(val) <- colnames(x)
return(val)
}
varNum(house)
Bedroom SquareFeet Followers VisitingTime TotalPrice UnitPrice
1 2 3 4 5 6
District Location
7 8
house1 <- house[,c(7,1:6)]
offDiag <- function(x,y,...){
panel.grid(h = -1,v = -1,...)
panel.hexbinplot(x,y,xbins = 15,...,border = gray(.7),
trans = function(x)x^.5)
# panel.loess(x , y, ..., lwd=2,col='red')
}
onDiag <- function(x, ...){
yrng <- current.panel.limits()$ylim
d <- density(x, na.rm = TRUE)
d$y <- with(d, yrng[1] + 0.95 * diff(yrng) * y / max(y) )
panel.lines(d,col = rgb(.83,.66,1),lwd = 2)
diag.panel.splom(x, ...)
}
splom(house1,as.matrix = TRUE,
xlab = '',main = "Beijing Housing Variables",
pscale = 0, varname.cex = 0.8,axis.text.cex = 0.6,
axis.text.col = "purple",axis.text.font = 2,
axis.line.tck = .5,
panel = offDiag,
diag.panel = onDiag
)
Error in grid.Call.graphics(C_downviewport, name$name, strict) : Viewport 'plot_01.panel.1.1.off.vp' was not found
Try installing the ellipse package. You do not need to load it as a library, only install it.
install.packages("ellipse")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With