[R] Lattice(barchart) related query

Girish A.R. garamach at gmail.com
Thu Jun 4 03:26:11 CEST 2009


Thanks a bunch, Coltrey! That works like a charm as well!


In summary, the code that solves both my queries is shown below:
---------------------------------------------------------------
mdat <- matrix(c
(-2.65,-3.7,-0.8,-1.4,-2.39,-1.12,-4.78,-4.9,-0.76,-1.56,
1.77,1.41,1.92,1.78,0.05,0.96,0.29,1.4,0.53,1.49,
1.4,0.35,1.65,2.14,1.88,2.75,1.86,0.32,2.96,2.28), nrow = 3, ncol=10,
byrow=TRUE, dimnames = list(c("A", "B","C"),c
("S-1","S-2","S-3","S-4","S-5","S-6","S-7","S-8","S-9","S-10")))

barchart(mdat,
        groups=FALSE,
        layout=c(2,5),
        aspect=0.7,
        reference=FALSE,
        as.table=TRUE,
        main=list("Maintitle",cex=1),
        panel=function(x, y, ...) {
                colours <- character()
                colours[x < 0] <- 'red'
                colours[x > 0] <- 'green'
                panel.barchart(x, y, col=colours, ...)
        },par.settings=list(grid.pars=list(fontfamily="mono")),
        xlab="x-axis labels")
---------------------------------------------------------

-Girish

=======
On Jun 3, 11:20 pm, Coltrey Mather <r-h... at cowsgomoo.org> wrote:
> No problem.  Sorry I ignored your font question, I have no personal
> experience, but this may help:https://stat.ethz.ch/pipermail/r-help/2009-April/196745.html




More information about the R-help mailing list