Advanced Data Visualization in R
As data become larger ,diverse and complex we require advance version of data visualization.
- Mosaic Plot
- 3D Graphs
- 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
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
# plot hexbin
#load color brewer
In order to add colors for better understanding of data we use the following commands.
tp <- colorRampPalette(rev(brewer.pal(40,’Set3′)))
hexbinplot(Y~X, data=burgers, colramp=tp)