Week 10: Animation
Introduction to Data Visualization
W4995.012 Spring 2023
00 Quiz
01 Sparks Presentation
02 Warm-up
03 Motion Perception
04 Animated Transitions in Vis
05 Implementing Animations
06 Final Projects, A4 Show-and-Tell
Zooming: Geometric or Semantic?
Too many to see: alpha transparency
Too many to see: jittering
Too many to see: contour, binning...
01
Long time no see!
Draw in 30 seconds: Where did you go for break?
Draw yourself: How much time did you spend on travel over spring break?
(not to scale!) ok
1hr
1-3hr
3-6hr
6-24hr
24+hr
A lot of days
0 hours
Drawing activity: in groups of 4, 15min.
Animate pie to bar chart
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
TOTAL SALES ($)
1
3
2
4
Animate scatterplot to bar chart
☕️
🍪
🥯
TOTAL REVENUE ($)
TOTAL SALES
Revenue per unit ($)
Units sold (#)
Radius = inventory (#)
cookies 🍪
bagels 🥯
coffee ☕️
1
3
2
4
Animate line chart to bar chart
1
3
2
4
☕️
🍪
🥯
Q1 TOTAL SALES ($)
TOTAL SALES
Mar.
$
cookies 🍪
bagels 🥯
coffee ☕️
Jan.
Feb.
Group Members: UNI1, UNI2, UNI3, UNI4
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
Group Members: ahx2001, ak4652, al3625, mms2408
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
Title
Labels
Group Members: tas2217, dp3129, tv2265, st3288
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🥯
🍪
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
TOTAL REVENUE ($)
Group Members: rw2921, eel2157, hw2936, UNI4
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
🍪
🥯
☕️
Group Members: add2155, cs4016
☕️
🍪
🥯
TOTAL REVENUE ($)
1
2
4
TOTAL SALES
Units sold (#)
TOTAL SALES
Units sold (#)
Radius = inventory (#)
TOTAL SALES
Revenue per unit ($)
Units sold (#)
Radius = inventory (#)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
TOTAL REVENUE ($)
☕️
🥯
🍪
☕️ 🥯 🍪
Group Members: ys3610, sw3709, jn2770, jp4361
☕️
🍪
🥯
TOTAL SALE($)
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
Group Members: jf3482, vv2317
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
Group Members: Paulette (pd2662), Chiamaka(cnc2164), Aaron (adm2216)
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
TOTAL SALES ($)
bagels 🥯
cookies 🍪
coffee ☕️
Group Members: ly2555, nkk2122, hjk2160
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
TOTAL SALES
Mar.
$
cookies 🍪
bagels 🥯
coffee ☕️
Jan.
Feb.
TOTAL SALES
.
$
cookies 🍪
bagels 🥯’
coffee ☕️
☕️
🥯
TOTAL SALES
$
🍪
.
Mar.
Feb.
Jan.
Mar.
Feb.
Feb.
Mar.
JAN - MAR
Group Members: yx2810, dw3013, zt2276, ja3569
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
🍪
TOTAL SALES ($)
TOTAL SALES ($)
☕️
🥯
Group Members: am5767, lg2908
☕️
🍪
🥯
TOTAL REVENUE ($)
1
3
2
4
TOTAL SALES
Revenue per unit ($)
Units sold (#)
cookies 🍪
bagels 🥯
coffee ☕️
1
TOTAL SALES
Revenue per unit ($)
Units sold (#)
Radius = inventory (#)
cookies 🍪
bagels 🥯
coffee ☕️
1
TOTAL SALES
Revenue per unit ($)
Units sold (#)
cookies 🍪
bagels 🥯
coffee ☕️
03
Motion Perception
Why Animation?
Animation for Narrative, by Pitch Interactive (2015)
Gestalt principle: Common Fate, or “flocking”
Human motion exhibits “visual pop-out”
George Mather
However, multiple object tracking has limits
Max ~4–6. Difficulty increases significantly at 6.
(Yantis 92; Pylyshn 88; Cavanagh 05)
Attribution of Causality, Michotte ‘46
What do you see?
Most observers report that "the red ball hit the blue ball." The blue ball moved "because the red ball hit it." Thus, the red ball is perceived to "cause" the blue ball to move, even though the balls are nothing more than colored disks on your screen that move according to a script.
Attribution of Causality (Michotte ‘46)
Redrawn Colin Ware 2004
Principles for (Cartoon) Animation
Does this work?
Example via Tamara Munzner
Systems biology viz: interactions are modeled
as a graph; nodes represent biomolecules (e.g. proteins
and genes), and edges represent interactions between them.
Small multiples is better; we can’t track many objects
Example via Tamara Munzner
04
Animated Transitions for Visualizations
Principles of Animation (Heer & Robertson ‘07)
→ ~Expressiveness principle
Principles of Animation (Heer & Robertson ‘07)
2. Apprehension
→ ~Effectiveness principle
“Animated Transitions in Statistical Graphics” ‘07
During analysis and presentation it is common to transition between related data graphics.
?
“Animated Transitions in Statistical Graphics” ‘07
Hypothesis: Staged transitions are better than direct animations for identification + change perception.
Staged Transitions?
?
Staged Transitions: stacked/grouped bars
Taxonomy of transitions
Heer & Robertson ‘07 Findings
“Effectiveness of Animation in Trend Visualization” research study
How does animation compare to static presentations of time-series?
Experiment: Subjects asked comprehension questions. Presentation condition included narration.
(Robertson et. al. InfoVis 2008)
Variant 1: Animated Scatterplot
Variant 2: Traces
Variant 3: Small multiples
Robertson ‘08 Findings
Analysis: Animation 82% slower than multiples
Animation Pros/Cons
Attention
Constancy
Causality
Engagement
Calibration
Helps
direct attention
change tracking
cause and effect
increase interest
Hurts
distraction
false relations
false agency
“chart junk”
too slow: boring, too fast: errors
Via Jeffery Heer
Case Study: A Day in the Life of Americans
Contrast: A Day in the Life of Americans (static)
Case Study: Obama Budget
05
Implementing Animations
Implementation Approaches
2. Transition-Based, aka tweening
Implementation Approaches
Frame-Based Animation
Frame-Based Animation
Frame-Based Animation
Illustration via Jeffery Heer
1
2
3
4
Frame-Based Animation
Illustration via Jeffery Heer
1
circle(10,10)
2
circle(15,15)
3
circle(20,20)
4
circle(25,25)
Frame-Based Animation
Illustration via Jeffery Heer
1
circle(10,10)
2
circle(15,15)
3
circle(20,20)
4
circle(25,25)
Frame-Based Animation
Illustration via Jeffery Heer
1
circle(10,10)
2
circle(15,15)
clear()
3
circle(20,20)
clear()
4
circle(25,25)
clear()
Implementation Approaches
Frame-Based Animation
Transition-Based, aka tweening (Hudson & Stasko ‘93)
step(fraction) { xnow = xstart + fraction * (xend - xstart); }
Transition-Based Animation a.k.a. “tweening”
Concept: You set the keyframes, toolkit interpolates for you.
Illustration via Jeffery Heer
1s
2s
3s
4s
circle(10,10)
circle(25,25)
Transition-Based Animation
from: (10,10), to: (25,25), duration: 3sec
Illustration via Jeffery Heer
1s
dx=25-10 x=10+(0/3)*dx
2s
x=10+(1/3)*dx
3s
x=10+(2/3)*dx
4s
x=10+(3/3)*dx
Transition-Based Animation
from: (10,10), to: (25,25), duration: 3sec
Toolkit manages frame-by-frame updates for you
Illustration via Jeffery Heer
1s
dx=25-10 x=10+(0/3)*dx
2s
x=10+(1/3)*dx
3s
x=10+(2/3)*dx
4s
x=10+(3/3)*dx
Easing (or “Pacing”) functions
When in doubt, use easing
D3 Transitions: based on any d3 selection
// Select SVG rectangles and bind them to data values.
var bars = svg.selectAll(“rect.bars”).data(values);
Example via Jeffery Heer
D3 Transitions: based on any d3 selection
// Select SVG rectangles and bind them to data values.
var bars = svg.selectAll(“rect.bars”).data(values);
// Animate: interpolate to target values with default timing
bars.transition()
.attr(“x”, (d)=> xScale(d.foo))
.attr(“y”, (d)=> yScale(d.bar))
.style(“fill”, (d)=>colorScale(d.bar));
Example via Jeffery Heer
D3 Transitions: parameters
// Animate: interpolate to target values with default timing
// see also Observable notebook on D3 ease functions
bars.transition()
.duration(500)
.delay(0)
.ease(d3.easeBounce)
.attr(“x”, (d) => xScale(d.foo))
...
Example via Jeffery Heer
D3 Transitions: what does this do?
bars.exit().transition()
.style(“opacity”, 0)
.remove();
Example via Jeffery Heer
D3 Transitions: exit selection
bars.exit().transition()
.style(“opacity”, 0)
.remove();
// animate elements leaving the display,
// fade out to fully transparent
// remove from DOM upon completion
Example via Jeffery Heer
CSS Transitions
a {
color: black;
transition: color 1s ease-in-out;
}
a:hover {
color: red;
}
Example via Jeffery Heer
CSS Transitions
a {
color: black;
transition: color 1s ease-in-out;
}
a:hover {
color: red;
}
Property
Duration
Easing
Example via Jeffery Heer
Demos & Resources
Summary: Animation
Animation & Narrative go together
Tony Chu https://www.youtube.com/watch?v=tuPjPaEcUKI
Narrative (next week)
Tony Chu https://www.youtube.com/watch?v=tuPjPaEcUKI
COVID Datasets
COVID Datasets: secondary impact
Definitely don’t have to do that!
Jan Diehm/The Pudding
07
A4 Show-and-tell
We’ll go around and share
Covid in NY Team
Team for Car Crashes Involving Pedestrians
Traffic Accident Group
RZNT
dp3129,ly2555,rw2921,hw2930
Changrong Zheng
HCCP - Heon(hjk2160), Chiamaka(cnc2164), Camille(ckn2115), Paulette(pd2662)
YelpDataset
Cuisine hunter
311
Game of Thrones
Questions?
Next Class…
Next week