Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add axes to 3D histogram (rgl)

Tags:

r

histogram

rgl

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)

like image 752
Andy Avatar asked May 08 '13 12:05

Andy


1 Answers

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.

like image 107
Dieter Menne Avatar answered Oct 03 '22 09:10

Dieter Menne