[R] Plotting Time Series Data by Month

R. Michael Weylandt michael.weylandt at gmail.com
Wed Dec 7 23:49:26 CET 2011

Glad to help!

There are definitely enough colors, but they aren't all assigned
numbers automatically: to see a list of built in ones, try colors()

You can always use a character string to specify a color as well --
but I think the easiest thing to do might be to use one of the palette
functions like rainbow() to make a whole set of colors equally spaced
throughout the rainbow.

For production/optimized colors, look into the RColorBrewer package --
there's a somewhat large body of research on the best way to choose
colors and that package will help automate that process.


On Wed, Dec 7, 2011 at 3:02 PM, crazedruff <smoochie3002 at gmail.com> wrote:
> Sorry about that, new to posting here! Your code was extremely helpful, and
> tweaking it a bit gave me the output I was looking for:
> plot( rep(1:12, 17), pox, col = rep(1:17, each = 12), xaxt = "n",
> ylab="Reported Cases",xlab =
> "Months", pch = 20, main="Monthly Trends of Chickenpox")
> axis(1, at = 1:12, labels = month.abb, padj = 0)
> legend(8, 28000,c("1993", "1994","1995","1996","1997","1998","1999","2000",
> "2001","2002","2003","2004","2005","2006","2007","2008","2009"), inset=.05,
> title="Years",
> c(1993:2009), pch=20, horiz=FALSE, cex=.7)
> Apparently there aren't enough colors for each year to have it's own
> individual color, but I think I can live with that. Thanks again!
> --
> View this message in context: http://r.789695.n4.nabble.com/Plotting-Time-Series-Data-by-Month-tp4162534p4170305.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at 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.

More information about the R-help mailing list