Graph visualization

  • Visualizes relational information
    • Weighted/unweighted, directional/bidirectional
  • Applications
    • Social networks
    • Biological networks (genetic)
    • Computer networks
    • Railway/bus networks

Tree visualization

  • Space-filling methods (sunburst chart, treemaps, circle packing)
  • Non-space filling methods (trees)
  • Aesthetics: node color/ size, link color/size

Treemaps, Circle packing and Sunburst diagrams

  • Recursively divides the space into areas according to the hierarchy (e.g. catalogue structure)
  • Aesthetics: size and color
    • Assuming: \(size(parent)=\sum size(kids)\)

Treemaps

  • Analysis: Comparing size/color of hierarchies between/within different levels

Example: World population

Circle packing

Example: Hierarchy for Flare ActionScript Library

Sunburst

Example: Hierarchy for Flare ActionScript Library

Tree

  • Aesthetics: Node/link size, node/link color
  • Can be used for classification result analysis
  • Analysis
    • Analyse each branch and terminal nodes
    • Compare information between nodes
    • Compare information between branches

Tree

Graph Visualization

  • Layout has great impact (influences understanding a lot)

  • Different layouts proposed

    • Force-directed layout - Repulsive and Spring forces - Optimization used to find equilibrium
    • Fixed layouts: circular, line,…
    • Minimizing other objectives (e.g. symmetry, edge crossing)

Graph visualization

Graph visualization

Analysis:

  • Which nodes are hubs?
  • Which links are strongest?
  • Which nodes are \(n\) steps away from some node?
  • Components with strong connections?
    • Relationships to groups?
  • How are different groups connected?
  • Shortest path between nodes
  • Community detection (densely connected nodes)
  • Other interesting substructures

Graph visualization

Graph visualization

  • Graph can be represented as adjacency matrix
  • Seriation methods can be used
  • Communities can be detected by heatmaps

Graph Visualization in R

  • A plenty of packages available
    • igraph: rich functionality, poor graphics
    • visNetwork: interactive graph visualization, can use igraph objects
    • ggraph: static graphs, based on the grammar of graphics, can use igraph
    • ggnet2 in GGally: static graphs
  • Describing graph objects - very package dependent
    • igraph/visNetwork/ggraph:
      • Nodes: data frame with “id” column (and other attrs)
      • Edges: data frame with “from” and “to” columns (and other attrs)

Animation

  • Eye is drawn to similar motions and outlying motions
  • Advantages
    • Effective at attracting attention
    • Time=one extra aesthetics
    • Easily perceived in peripheral vision ->many features can be captured at one time point
  • Disadvantages
    • Unappropriate transformation (transition) -> false conclusions
    • Speed of the graphics may hide important details/make boring

Animation- recommendations

  • Maintain valid data during transitions
    • Example: using splines
  • Be careful when using interpolations: use appropriate models
  • Group similar transitions
  • Minimize occlusion
  • Use simple transitions
  • If trajectory is stable, use ease-in, ease-out
  • Make transition as long as needed but no longer.

Gapminder

See http://www.gapminder.org

  • Gapminder is
    • A database that stores important world statistics (by country)
    • Each dataset can be analysed online with Motion Chart
    • Popularized by Hans Rosling
  • Check “Life expectancy” (years) in Gapminder

Gapminder

Life expectancy set

  • How the minimum and maximum life expectancies changed after 200 years
  • Which countries had in general the highest life expectancy? Lowest lifexpectancy? Highest income level? Lowest income level?
  • What happened after 1946 and why?
  • Compare development of China and USA (mark this countries and use “trace”)

How to create an animation?

  • Limited amount of timepoints

  • Smooth transition is desired

  • For each aesthetics \(x\), consider interpolation \(x'(t)\)

    • How to create?
      • Linear interpolation, splines, kernel smoothers…
      • Compute path length \(s(t)\)
      • Insert intermediate frames \(t_1, \ldots, t_n\) with \(x'(t_1), \ldots x'(t_n)\)

How to create an animation?

How to create an animation?

Inserting intermediate values:

Animation in R

  • Motion charts : googleVis package
  • Plotly: various animation, set time variable to frame aesthetics
    • Motion charts are simpler than googleVis

Animation in R

Example: power function

library(plotly)

m=matrix(nrow=0,ncol=3)
for (a in seq(0,3,by=0.03)) {
  x<-seq(0,2,0.01)
  y<-x^a
  m<-rbind(m,cbind(x,y,a))
}

df=as.data.frame(m)

plot_ly(df, x=~x, y=~y, frame =~a)%>%add_lines()%>%animation_opts(
  100, easing = "cubic", redraw = F
)

Animation in R

Example: power function

2D-tours

  • MDS and PCA projections
    • Is one projection enough to understand data?

##2D-tours

  • Idea
    • Investigate various projections
    • Connect them into animation
  • What to analyze?
    • Same as in scatterplots plus
    • Which variables contribute to projections
      • Patterns in lower dimensional manifold?
  • Types of 2d-tours: grand tour and guided tour

2D-tours

  • Grand tour for Car data

Projection math

  • Data matrix \(X=[n \times p]\)

  • Projection matrix \(A=[p \times d]\), \(d=2\)

    • Rows in \(A\): contribution of \(i\)th coordinate to projection
    • Columns in \(A\): coordinate of projecting vectors in \(R^p\)
  • Projected data \(Z=X\cdot A\)

  • Example: \(X=\left( \begin{matrix} 2 & 4 &3\\ 6 & 2 & 1\\ 2 & 9 & 9 \end{matrix} \right)\), \(A=\left( \begin{matrix} 1 & 0 \\ 0 & 1 \\ 0 & 0 \end{matrix} \right)\)

Grand tour

  • Idea: explore projections randomly
  1. Select some projection \(A_1\)
  2. Select next projection randomly \(A_2\)
  3. Create shortest path projections \(A_1^1, \ldots, A_1^k\) from \(A_1\) to \(A_2\)
  4. Select next projection randomly \(A_3\)

Grand tour

Guided tour

  • Idea: focus on “interesting” projections
    • Interest measure: projection pursuit index \(I(XA)\)
    • Go through local \(\max{I(XA)}\)


- Various PP indices: Holes, central mass,…

Guided tour

Algorithm:

  • Select some projection \(A_a\), calculate \(I_a\)
  • For i=1,2,…
    • \(A_i=A_a +c^i B\), \(B\)- random direction, \(c^i\)- “cooling parameter”
    • Move to \(A_i\) with probability depending on \(\Delta I\) (and create shortest path intermediate projections)
    • Set \(A_a=A_i\) if moved.

Guided tour

  • Note: path goes often through same points…

Read Home