Hands-on Exercise 5
Visualising and Analysing Multivariate Data
Overview
This hands-on exercise covers five chapters of the multivariate visualisation toolkit, working from simpler chart types to more complex ones.
The chapters move from simple to complex. Chapter 6 asks questions like “does GDP move up when life expectancy moves up?” by looking at two measurements at a time. Chapter 14 shows the full data as a coloured grid, with one row per country and one column per measurement, so a single glance reveals which countries are high or low across many things at once. Chapter 13 plots each country as a dot inside a triangle, which works when each country has three numbers that add up to a whole (such as young, working-age, and old as shares of the population). Chapter 15 extends this idea to many measurements at once, drawing each country as a zigzag line that crosses parallel vertical axes. Chapter 16 introduces hierarchy by nesting smaller rectangles inside bigger ones, so a property project sits inside a planning area, which sits inside a planning region. Reading the chapters in this order means each one builds on the previous, instead of feeling like five disconnected chart types.
Datasets Used
Four datasets carry across the five chapters:
wine_quality.csvfrom the UCI Machine Learning Repository, combining red and white wine samples with 13 variables and 6,497 observationsWHData-2018.csvfrom the World Happiness Report 2018, with country-level happiness scores and explanatory variablesrespopagsex2000to2018_tidy.csvfrom the Singapore Department of Statistics, recording resident population by planning area, subzone, age group, sex, and year from 2000 to 2018realis2018.csvfrom the URA REALIS portal, recording private property transactions in Singapore in 2018
Chapters
Chapter 6
Visual Correlation Analysis
Covers pairs(), ggcorrmat(), and corrplot() for visualising how pairs of variables move together.
Chapter 14
Heatmap for Visualising and Analysing Multivariate Data
Covers heatmap() and heatmaply() for showing the whole dataset as a coloured grid, with optional clustering and seriation.
Chapter 13
Creating Ternary Plot with R
Covers ggtern() for static ternary plots and plot_ly() for interactive ones, for three-part compositional data.
Chapter 15
Visual Multivariate Analysis with Parallel Coordinates Plot
Covers ggparcoord() for static parallel coordinates plots and parallelPlot() for interactive D3-based plots.
Chapter 16
Treemap Visualisation with R
Covers treemap(), treemapify for ggplot2 integration, and d3treeR for drill-down interactivity.