On Jan 26, 2008 11:23 PM, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > On 26/01/2008 5:24 AM, Geoff Russell wrote: > > Dear users, > > > > I'm trying to produce a 3d bar plot but the x and y dimensions have > > categorical > > data -- so I only want 3 points on each axis. So I try: > > > > > > require(scatterplot3d) > > > > mymat<-data.frame( > > x=c(1,1,1,2,2,2,3,3,3), > > y=c(1,2,3,1,2,3,1,2,3), > > z=c(1,2,3,4,5,6,7,8,9)) > > scatterplot3d(mymat, > > type="h", lwd=5, pch=" ", > > xlab="xlabel", ylab="ylabel", zlab="zlabel", > > xlim=c(1,3), ylim=c(1,3), > > lab=c(3,3), > > x.ticklabs=c("Low","Medium","High"), > > y.ticklabs=c("Green","Blue","Black"), > > main="My Bar Plot") > > > > But I still get x ticks at 1, 1.5, 2, 2.5, 3 on both x and y axes. I > > thought lab > > controlled this (according to the documentation). > > > > What am I doing wrong, or is there some restriction on the way the > > function works? > > I don't know the answer about scatterplot3d, but you can get > approximately what you want with the rgl package using > > > plot3d(mymat, > type="h", > xlab="xlabel", ylab="ylabel", zlab="zlabel", > xlim=c(1,3), ylim=c(1,3), > size=5, > axes=FALSE, > main="My Bar Plot") > > axis3d("x", at=1:3, labels=c("Low","Medium","High")) > axis3d("y", at=1:3, labels=c("Green","Blue","Black")) > grid3d("z", n=3)
I couldn't install rgl due to the following problems: g++ -I/usr/local/lib/R/include -I/usr/local/lib/R/include -DHAVE_PNG_H -Iext -I/usr/local/include -fPIC -c par3d.cpp -o par3d.o par3d.cpp: In function 'void Specify(const char*, SEXPREC*)': par3d.cpp:128: error: invalid conversion from 'const char*' to 'char*' par3d.cpp:128: error: initialising argument 1 of 'Rboolean Rf_psmatch(char*, char*, Rboolean)' par3d.cpp:135: error: invalid conversion from 'const char*' to 'char*' par3d.cpp:135: error: initialising argument 1 of 'Rboolean Rf_psmatch(char*, char*, Rboolean)' make: *** [par3d.o] Error 1 chmod: cannot access `/usr/local/lib/R/library/rgl/libs/*': No such file or directory ERROR: compilation failed for package 'rgl' But Uwe's suggestion with scatterplot3d gives a better result than I had. But I might use multiple 2d plots instead. Many thanks, Geoff. > > You might prefer to change the mouse controls to > > par3d(mouseMode=c("zAxis","zoom","fov")) > > so that the main mouse button does rotation about the vertical axis, > rather than completely general rotation. > > Duncan Murdoch > > -- 6 Fifth Ave, St Morris, S.A. 5068 Australia Ph: 041 8805 184 / 08 8332 5069 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.