On 2/15/2010 2:41 PM, Dimitri Shvorob wrote: > library(sqldf) > library(ggplot2) > > t = data.frame(t = seq.Date(as.Date("2009-01-01"), to = > as.Date("2009-12-01"), by = "month")) > x = data.frame(x = rnorm(5)) > df = sqldf("select * from t, x")
A simpler way to get random data that doesn't involve the sqldf package, and gets different x values for each date: df <- data.frame(t = seq.Date(as.Date("2009-01-01"), to=as.Date("2009-12-01"), by="month"), x=rnorm(60)) > qplot(factor(df$t), df$x, geom = "boxplot") + theme_bw() You are converting your dates to a factor, so they are no longer dates. I'm guessing you did this to get a separate boxplot for each date, but that is not the right way to do that. Use the "group" aesthetic to make different groups. qplot(df$t, df$x, geom = "boxplot", group=df$t) + theme_bw() > qplot(factor(df$t), df$x, geom = "boxplot") + theme_bw() + > scale_x_date(major = "months", minor = "weeks", format = "%b") qplot(df$t, df$x, geom = "boxplot", group=df$t) + theme_bw() + scale_x_date(major = "months", minor = "weeks", format = "%b") > qplot(factor(df$t), df$x, geom = "boxplot") + theme_bw() + > scale_x_date(format = "%b") qplot(df$t, df$x, geom = "boxplot", group=df$t) + theme_bw() + scale_x_date(format = "%b") -- Brian Diggs, Ph.D. Senior Research Associate, Department of Surgery, Oregon Health & Science University ______________________________________________ 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.