Advanced Data Visualization in R

As data become larger ,diverse and complex we require advance version of  data visualization.

1.Data Visualization

  1. Mosaic Plot
  2. 3D Graphs
  3. Hexbin Binning

1.1 Mosaic Plot

What is Mosaic Plot? Why to choose Mosaic Plot?

A mosaic plot is a graphical display that allows you to examine the relationship among two
or more categorical variables.

If you wanted to compare the mortality rates between men and women using a mosaic plot, you would first divide the unit square according to the overall proportion of males and females.

Here in the figure below about 30% are female and 70% are male.

Next we include more adjustments.


Secondly now we include one more variable that depict the survival of sexes.


In the above diagram in females about 60% survived and in male about 25% survived.

Now the next step is to how to plot this mosaic plot


#Plot Mosaic Plot




1.2 3D Graphs

We use  3D graphs to plot data in three dimensions.3D plots depicts the relationship between all the three variables and also shows the relationships between any of the two variables.

How to plot 3D Graphs

# Install rgl package and load library



#plot 3D graph
plot3d(var1,var2,var3,xlab= “ ”,ylab= “ ”,zlab= “ ”,type= “ ”,col= “ ”,size= “ ”)


1.3 Hexbin Binning

Hexagon binning is a form of bivariate histogram useful for visualizing the structure in datasets with large n.

How to plot hexbins

#load library


# plot  hexbin


#load color brewer




In order to add colors for better understanding of data we use the following commands.

#load library


#setting colramp

tp <- colorRampPalette(rev(brewer.pal(40,’Set3′)))


hexbinplot(Y~X, data=burgers, colramp=tp)

download (1).png


Leave a Reply

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

You are commenting using your 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