[R] Lattice(barchart) related query

Girish A.R. garamach at gmail.com
Wed Jun 3 15:56:32 CEST 2009


Hi,

I have been recently experimenting with the lattice package, which I
must admit is just great! However, I'm sort of stuck in modifying
certain parameters; Would appreciate some pointers on a couple of
things:

1) Is it possible to change the font of the labels (say to computer
modern)  -- either in the Windows output or thru' Sweave (generating
EPS/PDF)?
2) As you will notice, there are negative values in the data. Is it
possible to have a different color for the bars depicting negative
values?

Reproducible code pasted 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("Main
title",cex=1),xlab="x-axis labels")
----------------------------------------------------------------------------------------

Thanks,
-Girish



> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.
1252;LC_MONETARY=English_United States.
1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets
methods   base

other attached packages:
 [1] RWinEdt_1.8-1      coda_0.13-4        verification_1.29
CircStats_0.2-3
 [5] boot_1.2-36        fields_5.02        spam_0.15-4
waveslim_1.6.1
 [9] psychometric_2.1   multilevel_2.3     MASS_7.2-47
nlme_3.1-92
[13] languageR_0.953    lme4_0.999375-31   Matrix_0.999375-27
zipfR_0.6-5
[17] lattice_0.17-25    ggplot2_0.8.3      reshape_0.8.3
plyr_0.1.8
[21] proto_0.3-8        doBy_3.9           car_1.2-14

loaded via a namespace (and not attached):
[1] cluster_1.12.0   Formula_0.1-3    Hmisc_3.6-0
kinship_1.1.0-22 plm_1.1-2
[6] sandwich_2.2-1   splines_2.9.0    survival_2.35-4  tools_2.9.0




More information about the R-help mailing list