Dr Eberhard Lisse <e...@lisse.na> wrote: > Hi, > > I am reading payment data like so > > 2010-01-01,100.00 > 2010-01-04,100.00 > ... > 2011-01-01,200.00 > 2011-01-07,100.00 > > and plot it aggregated per month like so > > library(zoo) > df <- read.csv("daily.csv", colClasses=c(d="Date",s="numeric")) > z <- zoo(df$s, df$d) > z.mo <- aggregate(z, as.yearmon, sum) > barplot(z.mo, col="darkblue") > > How do I get the monthly aggregated payments in different colors > next to each other (ie for each year in a different color with the x > axis showing the months)?
Hi Dr Eberhard Lisse, You might also be interested in barp: paybymonth<-matrix(sample(100:200,120,TRUE),nrow=10) rownames(paybymonth)<-2000:2009 colnames(paybymonth<-month.abb library(plotrix) barp(paybymonth,names.arg=colnames(paybymonth),col=rainbow(10), ylim=c(0,250),main="Payments by month from 2000-2009") par(xpd=TRUE) legend(13,180,2000:2009,fill=rainbow(10)) par(xpd=FALSE) Jim ______________________________________________ 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.