Marcel,

tC <- textConnection("
Time Type1  Type2  Type3
1        .50       .25     .25
4        .55       .25     .20
5        .65       .20     .15
")
tmp <- read.table(header=TRUE, tC)
close.connection(tC)

require(lattice)

tmpdf <- data.frame(Time=rep(tmp$Time, 3), stack(tmp[,2:4]))
tmpdf
barchart(values ~ Time, group=ind, data=tmpdf, stack=TRUE, horizontal=FALSE,
         main="not there yet")
xyplot(values ~ Time, group=ind, data=tmpdf, stack=TRUE, horizontal=FALSE,
       panel=panel.barchart, ylim=c(-0.05,1.05), xlim=c(0,6),
       main="this does what you want")


Rich
On Mon, Jul 11, 2011 at 10:36 AM, marcel <marcelcur...@gmail.com> wrote:

> Hi All,
> New to R, but committed. I looked in a number of places but can't figure
> out
> my current problem. I have date of the type:
>
> Time Type1  Type2  Type3
> 1        .50       .25     .25
> 4        .55       .25     .20
> 5        .65       .20     .15
> etc
>
> which describe the frequency of types 1, 2 and 3 (adding up to 100%) over
> time. I would like to create a stacked bar chart showing these frequencies,
> each bar of height = 1, subsections of bars proportional to the frequency,
> and each bar located at the correct X (time) position. One difficulty is
> that the desired spacing of bar locations on the x-axis is irregular. Is
> this possible in R?
>
> Many thanks,
> Marcel
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Stacked-bar-plot-of-frequency-vs-time-tp3659715p3659715.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

        [[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.

Reply via email to