[R] 3D perspective of a contingency table

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Aug 24 09:14:26 CEST 2000


Charles RAUX wrote:
> 
> How can I draw a 3D perspective of a contingency table, that is
> showing 3D bars whose height is in proportion of the table cells?

You might want to try the package scatterplot3d, available at 
http://www.statistik.uni-dortmund.de/leute/ligges.htm

Assuming "cont" is your contingency table:

 cont <- matrix(1:16,ncol=4, byrow=T)
 rows <- as.vector(row(cont))
 cols <- as.vector(col(cont))
 scatterplot3d(rows, cols, as.vector(cont), type="h", pch=" ", angle=50,
lab=c(3,3), lwd=5)

You might also want to play with some arguments.

Note: scatterplot3d() is NOT designed to plot contingency tables and may
have many bugs in it. 
In the old version 0.2.11 it was possible to turn the plot 180 degrees
around, so the contigency table looks more "intuitive" (because of many
changes, this is not possible in version 0.3.0).

Using much of the code from scatterplot3d, it should not be too hard to
write a function like "plot.contingency()" ...

Regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list