Using ggplot2 to recreate 2012 Best Cities Results

April 18, 2013

(This article was first published on Adventures in Analytics and Visualization, and kindly contributed to R-bloggers)

Data from:
This time, I used ggplot2 to recreate the graphs created previously using Tableau. After all, R and ggplot2 are open source and free. Yes, I could leave a space between bars for different cities, but I wanted to be as close as possible to the tableau graphs previously generated. Yes, these are bar graphs for different cities, in contrast to area graphs generated by tableau. I tried area graphs with ggplot2 and although it was relatively simple to create them with “Rank of city” as a continuous var, it was much simpler to use bar graphs if I had to display the names of city on the axes (instead of just ranks).
First set of vars

Second set of vars

Third set of vars

To leave a comment for the author, please follow the link and comment on their blog: Adventures in Analytics and Visualization. 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.


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)