Data Visualization in R using ggplot and Shiny

In this post, I will share some of the data visualizations I’ve made in R. This includes Shiny apps as well.

Shiny App of Fertility Rate vs. Life Expectancy

The following links show two of my interactive plots that are hosted at shinyapps.io. The first one uses the googleCharts library, while the second one uses the ggvis library.

googleCharts – https://shivathudi.shinyapps.io/GoogleVis/

ggvis – https://shivathudi.shinyapps.io/ggvis/

Cancer Survival Rates using Slopegraphs

plot3

The plot that I made above is an Edward Tufte style slopegraph, depicting the long-term survival rates of cancer patients.

Beta Distribution

Beta Distribution Functions

Beta Probability Distribution Functions

Beta Cumulative Distribution Functions

The plots above show the pdfs and cdfs of beta distributions with different parameters. The first plot shows both the second and third plots through faceting.

Hotel Room Plots

Line graph plotting the room utilization rate in percent (y) against day of year, horizontally faceted by year:

linegraph_yearday_D

Line graph plotting the room utilization rate in percent (y) against day of year (x), horizontally faceted by weekday (Monday to Sunday, seven facets):

linegraph_weekday_F

Line graph plotting the mean room utilization rate in percent (y), against day of year from 1 to 365 (x), faceted horizontally by either weekday or weekend (two facets). Includes semi-opaque area indicating the min and max utilization for any given day:

linegraph_type_M

Line graph plotting the mean room utilization rate in percent (y), against day of year from 1 to 365 (x).  Includes a semi-opaque area indicating the min and max utilization for any given day:

linegraph_mean_P

Horizontal Cleveland dot plot plotting room name (y) on mean utilization in percent (x), grouping clusters by color:

Monday_6_MeansGrouping

Summary line and dot plot plotting total within SS (y) on number of clusters (x):

Monday__TotalWithinSS

Correlation matrix for mean utilizations for each room for each year. Insignificant correlations are x-ed out:

CorMat_2011

Comparing glmnet and gradient boosting

plot1

plot2

The two plots above compare the results of applying glmnet and gradient boosting to the same data.

Audience Dips after Commercial Breaks

audience_dips

Code

The code for all the plots can be found at my github repository which is located here.

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s