Skip to content

looking for a better way to code a bar graph

2 messages · Rubin, Norman, Hadley Wickham

#
Hi Norman,

This is pretty easy in ggplot2 (if you adjust your data a little):

install.packages("ggplot2")
library(ggplot2)

days <- seq(Sys.Date(), len=100, by="1 day")

df <- data.frame(
   date = rep(days, each = 3),
   trt = rep(c("A", "B", "C"), 50),
   price = runif(150)
)

qplot(date, price, data=df, geom="bar", stat="identity", fill=trt)
qplot(date, price, data=df, geom="bar", stat="identity", fill=trt,
position = "fill")
qplot(date, price, data=df, geom="bar", stat="identity", fill=trt,
position = "fill") + scale_fill_grey()

Hadley
On Fri, Sep 26, 2008 at 8:36 AM, Rubin, Norman <Norman.Rubin at amd.com> wrote: