cRazydays 2012 with ggplot2

December 17, 2011

(This article was first published on Knowledge Discovery » R, and kindly contributed to R-bloggers)

Season’s Greetings

Hi, dear R-bloggers and its readers. Here in Japan it’s very cold now.
The end of one year is coming soon.

How was your year 2011 ?

As for me, I started to learn R on september this year, and found it very enjoyable.
So I posted a few blog on R-bloggers, e.g. “Japan Quake Map“.

By the way, I made a “cRazydays 2012″ with ggplot2,
as another version of “CalendaR 2012“.
With best wishes for next year.

The image were rendered at 1920 × 1080 pixels, to be seen in HD.


Sample script of “cRazydays 2012″ is as follows:


# setting parameter
year <- 2012
d <- seq.Date(as.Date(paste(year, "-01-01", sep = "")), as.Date(paste(year, "-12-31", sep = "")), by="days")
z <- data.frame(Y = format(d, "%Y"), M = as.numeric(format(d, "%m")), D = as.numeric(format(d, "%d")), W = format(d, "%w"))
textangle <- sample(360, nrow(z), replace=TRUE)

# creating image with ggplot.
c <- ggplot(z, aes(D, M))
c + geom_text(aes(label=z$D, colour=factor(W), size = 20, angle =textangle)) +
scale_colour_manual(values = c(“magenta”, rep(“black”, 5),”darkturquoise”))+
scale_y_continuous(trans = “reverse”, breaks = 1:12) +
labs(x=””, y=””) +
title = paste(“cRazydays”, year, “\n”, sep = ” “),
plot.title = theme_text(colour = “black”),
legend.position = “none”

To leave a comment for the author, please follow the link and comment on their blog: Knowledge Discovery » R. offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.