[R] color and fontfamily in lattice

Sundar Dorai-Raj sdorairaj at gmail.com
Tue Feb 3 15:45:31 CET 2009


Try this:

dados <- data.frame(varsep = factor(rep(1:2,10)),
                    i = runif(20))

library(lattice)
font.settings <- list(
         font = 2,
         cex = 2,
         fontfamily = "serif")
my.theme <- list(
         box.umbrella = list(col = "red"),
         box.rectangle = list(col = "purple"),
         box.dot = list(col = "blue", pch = 15),
         par.xlab.text = font.settings,
         par.ylab.text = font.settings,
         axis.text = font.settings)
bwplot(varsep ~ i, dados,
       xlab = names(dados)[1],
       ylab = names(dados)[2],
       panel = function(...) {
       	 panel.grid(v = -1, h = 0)
       	 panel.bwplot(...)
       },
       par.settings = my.theme)

Type "trellis.par.get()" at the R command line to see other parameters
you can change. To change the settings on all plots, you can remove
the "par.settings" from the call to "bwplot" and simply use:

trellis.par.set(theme = my.theme)

HTH,

--sundar


2009/2/3 Leandro Marino <leandro at cesgranrio.org.br>:
>
>
>
>
> Hi,
> I am having some problems using bwplot(lattice) in my data. I want change some parameters:
> 1) Fontfamily to serif
> 2) The size of the font
> 3) Put it in a bold face
> 4) Change de color of the lines
>
> How can I do that?! Now, I am using this to plot my boxplot.
> dados <- data.frame(varsep=as.factor(rep(1:2,10)),i=runif(20))
> bwplot(dados[,'varsep']~dados[,'i'],xlab=names(dados)[2],ylab=names(dados)[1],panel =function(...){panel.grid(v = -1, h = 0);panel.bwplot(...)},font=2,fontfamily='serif')
>
> Thanks for any help on advance and sorry about my English.
>
>
>
>
>
>
>
>
>
>
> Atenciosamente,
> Leandro Lins Marino
> Centro de Avaliação
> Fundação CESGRANRIO
> Rua Santa Alexandrina, 1011 - 2º andar
> Rio de Janeiro, RJ - CEP: 20261-903
> R (21) 2103-9600 R.:236
> 0 (21) 8777-7907
> ( leandro at cesgranrio.org.br
>
> "Aquele que suporta o peso da sociedade
>    é precisamente aquele que obtém
>  as menores vantagens". (SMITH, Adam)
>
>   Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO AMBIENTE
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list