library(rgl)
## Warning in rgl.init(initValue, onlyNULL): RGL: unable to open X11 display
## Warning: 'rgl_init' failed, running with rgl.useNULL = TRUE
z <- volcano
x <- seq_len(nrow(z))
y <- seq_len(ncol(z))
for (i in seq_along(x)) {
lines3d(cbind(x[i], y, z[i, ]))
}
axes3d()
rglwidget() ## required in browser context, RStudio Server, RMarkdown, ...
rgl.clear()
## make dummy baseline for the walls on one side
## (for the other side we need to draw explicit vertical lines with segments...)
x2 <- c(0, seq_len(nrow(z)), nrow(z) + 1)
y2 <- c(0, seq_len(ncol(z)), ncol(z) + 1)
z2 <- rbind(0, cbind(0, z, 0), 0)
for (i in seq_along(x2)) {
lines3d(cbind(x2[i], y2, z2[i, ]))
}
axes3d()
rglwidget() ## required in browser context, RStudio Server, RMarkdown, ...