[R] Multiple groups barplot
michele caseposta
mic.cipi at gmail.com
Thu Nov 15 16:31:11 CET 2012
Hi Jim,
thanks again for your support.
Yes, I meant the subject codes; I will add a new variable and set the color to white all over.
Thanks,
Michele
On Nov 15, 2012, at 1:13 AM, Jim Lemon wrote:
> On 11/15/2012 07:21 AM, michele caseposta wrote:
>> Back again.
>> Is there a quick way to add the sample names in the plot?
>> I was not able to find anything other than creating a new category with the name in it (and the same color all over).
>
> Hi Michele,
> If by "sample names" you mean the variable names in your data frame:
>
> library(plotrix)
> mcdat<-data.frame(smk=c("No","No","Yes"),sex=c("M","M","F"),
> age=c(35,24,30))
> sizetree(mcdat,toplab=c("Smoker","Sex","Age"),
> col=list(c("gray80","gray20"),c("pink","lightblue"),rainbow(3)))
>
> This displays the variable names at the top of the stacked bars. If you mean the subject codes, then yes, you would have to create a new variable.
>
> Jim
More information about the R-help
mailing list