Question

I build a histogram in R using the rgl package.

library(rgl)
rgl.bg(col="#cccccc")
x<-rnorm(2500)
y<-rnorm(2500)
hist3d(x, y, alpha=0.8, nclass=10, scale=30)

enter image description here

How can I add an axis with labels on the plot?

Update

Solution:

axes3d(c('x','y','z'))
title3d('','','xlab','ylab','zlab')

source code hist3d is located in the demo(hist3d)

Was it helpful?

Solution

Add:

axes3d()

In case someone tries to run the above code: it is not self-contained, you need to copy the code for hist3d and binplot from ?hist3d.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top