[R] Bar plots with bars made of stacked text
Greg Snow
Greg.Snow at imail.org
Wed Mar 31 23:08:44 CEST 2010
Here is a start:
mydat <- list( Morning=c('Billy','Katy','Jonny'),
Noon=c('Billy','Patty','Suzie','Tom','Vicky'),
Evening=c('Amy','Jonny','Sally') )
sx <- rep( seq_along(mydat), sapply(mydat, length) )
sy <- unlist( lapply( mydat, seq_along ) )
plot(sx, sy, xlab='', ylab='', xaxt='n', yaxt='n', type='n',
xlim=c(0, max(sx)+1), ylim=c(0,max(sy)+1))
text(sx, sy, unlist(mydat), adj=0.5)
axis(1, at=unique(sx), lab=names(mydat) )
now just adjust the size of the plot (or change xlim and ylim) to get the spacing that you want.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Thomas Levine
> Sent: Wednesday, March 31, 2010 12:09 PM
> To: r-help at r-project.org
> Subject: [R] Bar plots with bars made of stacked text
>
> I would like to make bar plots where the bars are composed of text like
> this:
> http://www.thomaslevine.com/lowres/text_bars.png
>
> Is there a package that will help me with this? Thanks
>
> Tom
>
> ______________________________________________
> 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.
More information about the R-help
mailing list