Thanks David, it worked!

On Fri, Dec 4, 2009 at 10:36 PM, David Winsemius <dwinsemius@comcast.net>wrote:

>
> On Dec 4, 2009, at 10:17 PM, Xin Ge wrote:
>
> @ Francisco: Thanks, it worked.
>>
>>
>> @ All: I'm able to change the colors of legend using following code:
>>
>>  par.settings=simpleTheme(col=c(451,26,652)),
>>  key=list(space="right", cex=.96,
>>  text=list(c("A","B","C")),
>>  rectangles=list(size=1.7, border="white", col = c(451,26,652)))
>>
>> *Q. Using the following code, how can I change the color of
>> boxes where "SITE" names are written -- by default its pink. *
>> **
>>
> Assuming that by the "boxes" you are referring to what lattice terminology
> calls the "strips", then:
>
>  library(lattice)
>> barchart(yield ~ variety | site, data = barley,
>>       groups = year, layout = c(1,6), stack = TRUE,  # Add the following
>>
>         strip = strip.custom( bg="red"),
>
>       auto.key = list(points = FALSE, rectangles = TRUE, space = "right"),
>>       scales = list(x = list(rot = 45)))
>>
>
> HTH;
> David.
>
>>
>> Thanks,
>> Xin
>>
>>
>> On Fri, Dec 4, 2009 at 8:04 PM, Francisco J. Zagmutt <
>> gerifalte28@hotmail.com> wrote:
>>
>> Hello Xin,
>>>
>>> Take a look at the examples under ?print.trellis
>>>
>>> Using your original example, you could use:
>>>
>>> require(lattice)
>>> p1=barchart(yield ~ variety | site, data = barley,
>>>
>>>       groups = year, layout = c(1,6),
>>>       ylab = "Barley Yield (bushels/acre)",
>>>       scales = list(x = list(abbreviate = TRUE,
>>>                     minlength = 5)))
>>> p2=barchart(yield ~ variety | site, data = barley,
>>>
>>>       groups = year, layout = c(1,6), stack = TRUE,
>>>       ylab = "",
>>>       scales = list(x = list(rot = 45)))  #I removed the legend and ylab
>>> to make it look a bit better
>>>
>>>
>>> print(p1, split=c(1,1,2,1), more=TRUE)
>>> print(p2, split=c(2,1,2,1))
>>>
>>>
>>> I hope this helps,
>>>
>>> Francisco
>>>
>>> Francisco J. Zagmutt
>>> Vose Consulting
>>> 1643 Spruce St., Boulder
>>> Boulder, CO, 80302
>>> USA
>>> www.voseconsulting.com
>>>
>>> Xin Ge wrote:
>>>
>>> Hi All,
>>>>
>>>> I'm trying par(mfrow(c(1,2))) with barchart(), but its not working. Can
>>>> I
>>>> display two or more barcharts on a same page using some other function?
>>>> I'm
>>>> using following code --- where barchart() part is taken from help
>>>> manual.
>>>>
>>>> library(lattice)
>>>> par(mfrow=c(1,2))
>>>> barchart(yield ~ variety | site, data = barley,
>>>>       groups = year, layout = c(1,6),
>>>>       ylab = "Barley Yield (bushels/acre)",
>>>>       scales = list(x = list(abbreviate = TRUE,
>>>>                     minlength = 5)))
>>>> barchart(yield ~ variety | site, data = barley,
>>>>       groups = year, layout = c(1,6), stack = TRUE,
>>>>       auto.key = list(points = FALSE, rectangles = TRUE, space =
>>>> "right"),
>>>>       ylab = "Barley Yield (bushels/acre)",
>>>>       scales = list(x = list(rot = 45)))
>>>> par(mfrow=c(1,1))
>>>>
>>>> Thanks,
>>>> Xin
>>>>
>>>>      [[alternative HTML version deleted]]
>>>>
>>>>
>>>>
>>        [[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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>

	[[alternative HTML version deleted]]


