Try this:

with(dados,barchart(Medias * 100 ~ trat | Yvar, col =  grey(seq(0, 1, l =
nlevels(trat)))))


On Mon, Aug 9, 2010 at 8:18 AM, Ronaldo Reis Junior <chrysopa@gmail.com>wrote:

> Hi,
>
> I try to plot bars with different colours in a barchart graphic. My idea
> is make that all X-Levels from trat var with different colour (grey
> scale). I search for a solution but dont find any.
>
> Any help?
>
> Thanks
>
> dados <- structure(list(Medias = c(0.994169096209855, 0.99416342412449,
> 0.974683544303797, 0.954430379746835, 0.669047619047619, 0.999999998475569,
> 0.994163424124514, 0.99240506329114, 0.929113924050633, 0.70952380952381,
> 0.999999999473166, 0.999999999439193, 0.99746835443038, 0.99746835443038,
> 0.923809523809524, 0.862973760932945, 0.784046692606905, 0.645569620253165,
> 0.555035128805621, 0.470886075949367, 0.932944606413993, 0.809338521400778,
> 0.668354430379747, 0.608040201005025, 0.606060606060606), ICI =
> c(0.976994567793296,
> 0.98206380431608, 0.953595979983429, 0.928839427641527, 0.622608688475051,
> 1, 0.982063775957542, 0.976722631854148, 0.899246653813278,
> 0.664275771030459,
> 1, 1, 0.98225705686684, 0.98225705686684, 0.894238146710719,
> 0.802350976424288, 0.729009506353544, 0.575768730809864, 0.487173600236996,
> 0.401669070838163, 0.890549164444155, 0.762545402476806, 0.607108256850681,
> 0.545852506856716, 0.546177521647536), ICS = c(0.998541256282513,
> 0.99811638878729, 0.986325619477418, 0.971104547021077, 0.712411667007983,
> 1, 0.998116391814118, 0.997548444402608, 0.950613606532198,
> 0.750959759947381,
> 1, 1, 0.999643506018429, 0.999643506018429, 0.94561548964544,
> 0.90715403340414, 0.830504883009395, 0.70967681170475, 0.620904467505572,
> 0.541241164275512, 0.959662136271508, 0.848739648593426, 0.724387494422558,
> 0.666908727580774, 0.66291862672965), trat = structure(c(5L,
> 1L, 3L, 2L, 4L, 5L, 1L, 3L, 2L, 4L, 1L, 5L, 2L, 3L, 4L, 5L, 1L,
> 2L, 4L, 3L, 5L, 1L, 2L, 3L, 4L), .Label = c("O", "P",
> "Pl", "T", "TN"), class = "factor"), Yvar = structure(c(2L,
> 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 5L, 5L,
> 5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L), .Label = c("0BG",
> "0BP", "0T", "1A", "1D"), class = "factor")), .Names = c("Medias",
> "ICI", "ICS", "trat", "Yvar"), row.names = c("tratTN", "tratO",
> "tratPl", "tratP", "tratT", "tratTN1", "tratO1",
> "tratPl1", "tratP1", "tratT1", "tratO2", "tratTN2",
> "tratP2", "tratPl2", "tratT2", "tratTN3", "tratO3",
> "tratP3", "tratT3", "tratPl3", "tratTN4", "tratO4",
> "tratP4", "tratPl4", "tratT4"), class = "data.frame")
>
> library(lattice)
>
> dados$Yvar <- as.factor(dados$Yvar)
>
> with(dados,barchart(Medias*100~trat|Yvar,col="gray50"))
>
> --
> 10ª lei - Seu orientador espera que a sua produtividade seja baixa
> inicialmente e esteja acima da média após um ano.
>
>       --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228.
> >  Prof. Ronaldo Reis Júnior
> |  .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional
> | : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
> | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
> |   `- Fone: (38) 3229-8192 | ronaldo.reis@unimontes.br
> | http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

