[R] improving a bar graph

hadley wickham h.wickham at gmail.com
Sun Dec 16 18:19:09 CET 2007

On 12/16/07, Bob Green <bgreen at dyson.brisnet.org.au> wrote:
> Hello,
> Below is the code for a basic bar graph. I was seeking advice
> regarding the following:
> (a)  For each time period there are values from 16 people. How I can
> change the colour value so that each person has a different colour,
> which recurs across each of the three graphs/tie epriods?
> (b) I have seen much more sophisticated examples using lattice (e.g
> each person has a separate panel/plot). I am open to alternative code
> as to how I could present this data.

Why not use a line plot?  It would be much easier to see how an
individual is changing over time.  Here's a simple way to do that
using ggplot2:

df  <- data.frame(Time1, Time2, Time3)
df$id <- 1:nrow(df)
dfm <- melt(df, id="id")

qplot(variable, value, data=dfm, group=id, geom="line")



More information about the R-help mailing list