[R] Creating a Clustered-Stacked Column Chart

David Winsemius dwinsemius at comcast.net
Sat Oct 10 04:33:53 CEST 2009


library(lattice)
barchart(Titanic, scales = list(x = "free"),
           auto.key = list(title = "Survived"))

Or if you prefer vertical:

barchart(Titanic, scales = list(x = "free"),
          auto.key = list(title = "Survived"), horizontal=FALSE)

There are adjustments available to the space between bars.

barchart(Titanic, scales = list(x = "free"),
          auto.key = list(title = "Survived"), horizontal=FALSE,  
box.ratio=100)


On Oct 9, 2009, at 9:57 PM, zhijie zhang wrote:

> Thanks a lot. Maybe someone else has the method to solve that.
>
>
> 2009/10/9 John Kane <jrkrideau at yahoo.ca>
>
>> I don't think I've seen an R version, probably because the  
>> technique is not
>> very good for displaying data.
>>
>> Have a look at http://chartsgraphs.wordpress.com/tag/r-and-excel/  
>> for an
>> alternative method of displaying the data using lattice.
>>
>> --- On Fri, 10/9/09, zhijie zhang <rusers.sh at gmail.com> wrote:
>>
>>> From: zhijie zhang <rusers.sh at gmail.com>
>>> Subject: [R] Creating a Clustered-Stacked Column Chart
>>> To: r-help at stat.math.ethz.ch
>>> Received: Friday, October 9, 2009, 5:31 AM
>>> Hi all,
>>>   In R, is there some functions or ways to
>>> create a Clustered-Stacked
>>> Column Chart as the example in the following page
>>> http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html?
>>>  I have browsed the R Graph Gallery (
>> http://addictedtor.free.fr/graphiques/)
>>> and searched the R site, and didnot find an appropriate
>>> method to do it.
>>>  Anybody has met this problem before?
>>>  Thanks a lot.
>>>
>>>    [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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<http://www.r-project.org/posting-guide.html 
>> >
>>> and provide commented, minimal, self-contained,
>>> reproducible code.
>>>
>>
>>
>>      
>> __________________________________________________________________
>> Get the name you've always wanted @ymail.com or @rocketmail.com! Go  
>> to
>> http://ca.promos.yahoo.com/jacko/
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list