Parallel Coordinates Plots

Author

farrahmf

Published

February 11, 2023

Modified

March 11, 2023

Loading Packages and Importing Dataset

pacman::p_load(GGally, parallelPlot, tidyverse)
wh <- read_csv("data/WHData-2018.csv")

Using boxplot()

ggparcoord(data = wh, 
           columns = c(7:12), 
           groupColumn = 2,
           scale = "uniminmax",
           alphaLines = 0.2,
           boxplot = TRUE, 
           title = "Parallel Coordinates Plot of World Happines Variables")

With facet wrap and x-axis labels at 30 deg rotation.

ggparcoord(data = wh, 
           columns = c(7:12), 
           groupColumn = 2,
           scale = "uniminmax",
           alphaLines = 0.2,
           boxplot = TRUE, 
           title = "Multiple Parallel Coordinates Plots of World Happines Variables by Region") +
  facet_wrap(~ Region) + 
  theme(axis.text.x = element_text(angle = 30))

Using parallelPlot

wh <- wh %>%
  select("Happiness score", c(7:12))
parallelPlot(wh,
             width = 320,
             height = 250,
             rotateTitle = TRUE)

with histogram

histoVisibility <- rep(TRUE, ncol(wh))
parallelPlot(wh,
             rotateTitle = TRUE,
             histoVisibility = histoVisibility)