CalendaR 2012 with ggplot2

[This article was first published on Knowledge Discovery » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 “CalendaR 2012 with ggplot2″.
With best wishes for next year.


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


Sample script of “CalendaR 2012 with ggplot2″ is as follows:


# setting a 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"))

# creating a image with ggplot2.
c <- ggplot(z, aes(D, M))
c + geom_text(aes(label=z$D, colour=factor(W), size = 20)) +
scale_colour_manual(values = c(“magenta”, rep(“black”, 5),”darkturquoise”))+
scale_y_continuous(trans = “reverse”, breaks = 1:12) +
labs(x=””, y=””) +
title = paste(“CalendaR”, 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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)