## There are at least two options, one using mosaic and the other
using barchart.
## Here are both.

## this is your data
ld<-matrix(c(25,25,50,10,30,60,15,35,50,30,30,40),nrow=4,byrow=T)
ntreat2<-c("n0","n96","n0","n96")
rownames(ld)<-ntreat2
typ<-c("gr","fo","le")
colnames(ld)<-typ

## now some rearrangements

dim(ld) <- c(2,2,3)
dimnames(ld) <- list(ntreat2=c("n0","n96"),
                     rep=c(1,2),
                     typ=c("gr","fo","le"))

ld.df <- as.data.frame.table(ld)

require(vcd)
mosaic(ld, direction=c("v","v","h"), highlighting="typ")

require(lattice)
barchart(Freq ~ rep|ntreat2, group=typ, data=ld.df,
         origin=0, stack=TRUE)


## both mosaic and barchart have many arguments that you can use for
## finer control of the appearance.

______________________________________________
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.

Reply via email to