[R] scatterplot3d with categorical data
Uwe Ligges
ligges at statistik.tu-dortmund.de
Sat Jan 26 18:29:25 CET 2008
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
Dear Geoff,
scatterplot3d was never intended to draw a plot for categorical data,
but you can tweak it as follows:
- Note that the help page says (stolen from ?par) "The values of x and
y give the (approximate) number of tickmarks on the x and y axes." where
"approximate" is stressed in this context. It works for me to use lab =
c(2,2)
- add argument mar = c(3,3,3,3)
- add argument y.margin.add = 0.15,
Best,
Uwe
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?
>
> Cheers,
> Geoff Russell
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list