[R] 3-D barplot

Terry Therneau therneau at mayo.edu
Wed Dec 23 21:51:01 CET 2009


> I would like to create a 3 dimensional barplot of 16 odds ratios that
> demonstrate an interaction between two variables (CD14 and CD23).

odds<- matrix( c(1, 0.61, 2.1,     6.1,
                          1.5 ,    1.3,     3.5,     11.9,
                          1.8 ,    1.5,     4.4,     10.6,
                          8.2 ,    4.6,     5.5,     16.8), 
              4,4, byrow=T)

matplot(1:4, odds, type='b', log='y', xaxt='n',
        xlab='CD23', ylab='Odds Ratio')
axis(1, 1:4, 1:4)

  No, this did not create a 3-d bar plot, it created something far more
useful.  In this plot you can see that most of the data fits an additive
model and how well it does so.  It is much better than what you
requested -- which isn't hard as a 3-d barplot is one of the worst tools
ever made for information conveyance.  

Terry Therneau




More information about the R-help mailing list