# Interacting, on demand, with 2012 best cities data and plotting different graphs —- Experiments with ggplot2 on shiny server

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**Adventures in Analytics and Visualization**, 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.

Data from slides on Bloomberg businessweek’s site: http://images.businessweek.com/slideshows/2012-09-26/americas-50-best-cities

In this post, I show how one can interact with a dataset and generate graphs on the fly (technically, I’ve predetermined which graphs to create, but it should not be difficult to build a menu of possible graphs).~~This required setting up the shiny server running on Ubuntu. This current server is being hosted by Gonzaga. ~~Big thanks to Bob Toshack for help in trying to get the server public. Work in progress. In the meanwhile, I am using the services provided by RStudio for hosting this. Thanks a ton, RStudio, for this opportunity and the wonderful set of tools you have. And I am getting tired of this best cities dataset. So, the last few apps using that. Please click on the pictures below to go to the site and play with it. Remember to come back to go to the next set of interactive graphs.

1. Generating bar plots and/or dot plots of any variable you choose (from the preloaded data).

2. Comparing distributions of two different variables (can be extended to more than 2 variables) using their bar graphs (can use other graphs as well).

3. Exploring the relationship between two different variables for cities of different ranks.Scatter plots of rank of cities, by two variables.

4. Extending the above scatter plot to simultaneously see two scatter plots and four variables.

In this post, I show how one can interact with a dataset and generate graphs on the fly (technically, I’ve predetermined which graphs to create, but it should not be difficult to build a menu of possible graphs).

1. Generating bar plots and/or dot plots of any variable you choose (from the preloaded data).

2. Comparing distributions of two different variables (can be extended to more than 2 variables) using their bar graphs (can use other graphs as well).

3. Exploring the relationship between two different variables for cities of different ranks.Scatter plots of rank of cities, by two variables.

4. Extending the above scatter plot to simultaneously see two scatter plots and four variables.

To

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