CalendaR 2012 with ggplot2

December 14, 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 “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 on topics such as: Data science, Big Data, R jobs, 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.

Search R-bloggers


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)