[R-br] adicionar texto ou legenda em barchart

Alexandre Heinemann abh900 em gmail.com
Quinta Junho 2 14:21:15 BRT 2011


Caros Colegas,

Gostaria de adicionar o seguinte texto "a)" em um gráfico barchart. Esse
texto deve ficar acima do grafico do lado esquerdo.
 Entretanto, qdo insiro o comando no codigo do barchart

#legend=list(top=list(fun=textGrob("a)"), x=0, just="left",
gp=gpar(cex=0.8)))

a legenda atual "1-Nov, 1-Dec, 31-Dec" que está acima some.

Segue abaixo o codigo que estou utilizando:
#----------início----------------------------------------------
library(lattice)
library(grid)

T1 <- expand.grid(modelo=rep(c("A", "B", "C", "D", "E"),12))
T2 <- expand.grid (data = rep(c(rep(c("1-Nov"),5),rep(c("1-Dec"),5),
rep(c("31-Dec"),5)),4))
T3 <- c(rep(c("X1"),15), rep(c("X2"),15),rep(c("X3"),15),rep(c("X4"),15))
T4 <- rnorm(60, mean=10, sd=5)

teste <- cbind(T1,T2,T3,T4)

teste$data <- factor(teste$data, levels = c("1-Nov","1-Dec","31-Dec" ))
teste$modelo = factor(teste$modelo, levels = c("A", "B", "C", "D", "E"))
teste$T3 <- factor(teste$T3, levels = c("X1","X2","X3","X4" ))

barchart (modelo ~ teste$T4 |teste$T3 , data = teste, xlab = "XXXXX",ylab =
" XXXXX",
groups = teste$data, auto.key = list( space="top", columns = 3, points =
FALSE, rectangles = TRUE, cex=0.8, size=1.4, adj=1,between=0.2,
between.colums=0.1),col=gray.colors(3)[1:3], box.ratio = 1.5,aspect=0.6,
layout=c(1,4),par.settings = list(superpose.polygon =
list(col =gray.colors(3)),fontsize=list(text=9)),
par.strip.text=list(cex=0.9),scales = list(x = list(tick.number = 6)),
strip=strip.custom(bg="gray95",factor.levels=c("X1","X2","X3","X4")),
panel=function(x, y, ...)
          {
          panel.barchart(x, y, ...)
          panel.abline(v=(9.8), col="gray60",  lty=2)
          })

#----------------fim----------------------------------------------------------------------------

Atenciosamente,

Alexandre
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20110602/11c6219b/attachment.html>


Mais detalhes sobre a lista de discussão R-br