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
Quiz
5 min
Closed book
01
Long time no see!
Draw in 30 seconds: Where did you go for break?
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.
Animate line chart to bar chart
1
3
2
4
☕️
🍪
🥯
Q1 TOTAL SALES ($)
TOTAL SALES
Mar.
$
cookies 🍪
bagels 🥯
coffee ☕️
Jan.
Feb.
Group Members: hla2126, cpp2129, smb2346, vd2468
1
3
2
4
☕️
🍪
🥯
TOTAL REVENUE ($)
TOTAL SALES
Revenue per unit ($)
Units sold (#)
Radius = inventory (#)
cookies 🍪
bagels 🥯
coffee ☕️
TOTAL SALES
☕️
🍪
🥯
TOTAL REVENUE ($)
Group Members: agt2120, td2748, yy3204, aqa2001
1
3
2
4
☕️
🍪
🥯
Q1 TOTAL SALES ($)
TOTAL SALES
Revenue per unit ($)
Units sold (#)
Radius = inventory (#)
cookies 🍪
bagels 🥯
coffee ☕️
TOTAL SALES
Revenue per unit ($)
Units sold (#)
cookies 🍪
bagels 🥯
coffee ☕️
🍪
🥯
☕️
TOTAL SALES ($)
Group Members: cfg2138, bs3370, ljc2187, as7172
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
TOTAL SALES ($)
coffee ☕️
bagels 🥯
☕️
cookies 🍪
🥯
🍪
TOTAL SALES ($)
TOTAL SALES ($)
Group Members: jx2515, hz2995, UNI3, UNI4
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
TOTAL SALES ($)
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
coffee ☕️
cookies 🍪
bagels 🥯
TOTAL SALES ($)
Group Members: ng2985, ks3827
1
3
2
4
1
TOTAL SALES
Revenue per unit ($)
Units sold (#)
Radius = inventory (#)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
TOTAL REVENUE ($)
☕️☕️☕️☕️☕️
🥯
🍪
TOTAL REVENUE ($)
Unite Sold illustrated by number of icons(scaled)
🍪
☕️
🍪
🍪
🍪
🍪
☕️
☕️
☕️
☕️
☕️
☕️
☕️
🍪
🍪
🍪
🍪
🍪
🍪
🍪
🍪
☕️
☕️
☕️
☕️
☕️
🥯
☕️
☕️☕️
☕️
☕️☕️
☕️
🥯
🥯
🥯
🥯
🥯
🥯
🥯
🥯
🥯
🥯
🍪
🍪
🍪
🍪
🥯
TOTAL REVENUE ($)
(area)
🍪
🥯
Group Members: ss6679, wz2628, cf3021, ey2338
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
TOTAL SALES ($)
☕️
🍪
🥯
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
TOTAL SALES ($)
☕️
TOTAL SALES ($)
🥯
🍪
Group Members: sjp2226, sf3218, ls3594
1
3
2
4
☕️
🍪
🥯
TOTAL REVENUE ($)
TOTAL SALES
Revenue per unit ($)
Units sold (#)
Radius = inventory (#)
cookies 🍪
bagels 🥯
coffee ☕️
1
3
Units sold (#)
Revenue per unit ($)
zoom out
Note how each rectangle area (rev per unit * units sold) represents the bar’s height
Group Members: lbh2148, dar2209, jx2514, rl3431
1
3
2
4
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
TOTAL SALES ($)
cookies 🍪
bagels 🥯
coffee ☕️
coffee☕️
cookies 🍪
bagels 🥯
TOTAL SALES ($)
TOTAL SALES ($)
Group Members: UNI1, UNI2, UNI3, UNI4
1
3
2
4
Group Members: ham2167, eam2316, al4402
1
3
2
4
☕️
🍪
🥯
Q1 TOTAL SALES ($)
TOTAL SALES
Mar.
$
cookies 🍪
bagels 🥯
coffee ☕️
Jan.
Feb.
TOTAL SALES
$
cookies 🍪
bagels 🥯
coffee ☕️
TOTAL SALES
$
☕️
🍪
🥯
Group Members: dwr2118, akc2206, kjl2175
1
3
2
4
TOTAL SALES
Mar.
$
cookies 🍪
bagels 🥯
coffee ☕️
Jan.
Feb.
TOTAL SALES
$
cookies 🍪
bagels 🥯
coffee ☕️
☕️
🍪
🥯
Q1 TOTAL SALES ($)
TOTAL SALES
$
🍪
🥯
☕️
Rotate lines + scale to correct vals + �Remove x axis labels
Axis labels move down
Extrude lines into rectangles
03.1
Animation Readings
Zooming: Geometric or Semantic?
Too many to see: alpha transparency
Too many to see: jittering
Too many to see: contour, binning...
03.2
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
Finding a dataset
Jan Diehm/The Pudding
07
A4 Show-and-tell
We’ll go around and share
For example
Comparing GDP growth vs. CO₂ reductions in various countries
Description of the question being asked, the main insight and a hint at the things that can’t be seen in the screenshot but are covered in more detail in the interactive visualization
One thing that was surprisingly hard…
One thing that was surprisingly fun…
Link to the interactive visualization:
http://example.com/my-viz
Interactive Corruption World Map
In this visualization, we aim to capture the difference in perceived corruption vs. actual corruption. Perceived corruption, which we derive from happiness scores provided by the World Happiness Report, reflects how corruption influences individual's sense of well-being. Actual corruption is provided by Worldwide Governance Indicator data from the World Bank. By comparing both metrics, the visualization highlights the discrepancies between what people feel based on their overall well-being, and the reality in a given country.
One thing that was surprisingly hard… was transforming the corruption score from both sources to be comparable.
One thing that was surprisingly fun.. was being able to experiment with many different interactivity features
Link to the interactive visualization:
https://observablehq.com/d/c06a7bf9781bbdf9
IMDB Data!
How are the top 1000 movies connected by their top 4 leading actors? Is there a connection between those movies and their gross income?
One thing that was surprisingly hard…
Making the same points change and highlight between both graphs
One thing that was surprisingly fun…
Seeing the different ways that movie actors were connected!
Link to the interactive visualization:
https://observablehq.com/d/ef26ac61890ca27b
Class-C Violations (with al4402, cf3021, hla2126, & ham2167)
Choropleth map of unresolved Class-C housing code violations in NYC rental units by census tract. When you hover over a census tract, a tooltip pops up with the census tract ID, the number of violations per rental unit and the name of the approximate neighborhood the tract covers.
One thing that was surprisingly hard…
Designing the zoom functionality
One thing that was surprisingly fun…
Linking the borough dropdown menu to the actual visualization
Link to the interactive visualization:
Mumbai Pollutant
Description of the question being asked, the main insight and a hint at the things that can’t be seen in the screenshot but are covered in more detail in the interactive visualization
What are the various pollutant levels in different areas of Mumbai between 2018 and 2020?
One thing that was surprisingly hard…
Trying to make a date-range zoom slider
One thing that was surprisingly fun…
Creating a dropdown for the different types of pollutants
Link to the interactive visualization:
https://observablehq.com/d/2d8775fed1036271
The Caitlin Clark Effect (with Adira, Lucy, Jeffrey, and Sarah)
How did Caitlin Clark’s draft into the WNBA impact WNBA attendance figures? Did attendance at the WNBA increase in general, or did people go especially to see Clark play?
One thing that was surprisingly hard…
One thing that was surprisingly fun…
Link to the interactive visualization:
https://observablehq.com/d/70d83934aa58f30f
Soundwaves of Popularity (Alex, Kimiya, Vishal, and Logan)
We chose to answer the question “What makes music genres popular?” through a data-rich visualization comparing genres’ popularities along the x-axis to various calculated aspects of the music itself provided by the data set.
Through interacting with the visualization, onca can see insights into which musical aspects within a specific genre influence its overall popularity.
One thing that was surprisingly hard was getting the colors to return back to normal for the different representations e.g. going back to the right shade of green or going back to grey when a genre group was selected.
One thing that was surprisingly fun was exploring the dataset. The data had a lot of really cool derived data like danceability, energy, valence, etc.
Link to the interactive visualization:
https://observablehq.com/d/ac908ec6eaef9729
Arkeenichel (with akc2206, kjl2175, rl3431, & ng2985)
Description of the question being asked, the main insight and a hint at the things that can’t be seen in the screenshot but are covered in more detail in the interactive visualization
One thing that was surprisingly hard…
Getting zooming to work well without strange/unexpected/unintuitive behavior
One thing that was surprisingly fun…
Seeing our abstract ideas being implemented (especially the stacked ranking functionality)
Link to the interactive visualization:
Spotify (dwr2118, sf3218, sj3229, sjp2226 )
Description of the question being asked, the main insight and a hint at the things that can’t be seen in the screenshot but are covered in more detail in the interactive visualization
We used a Spotify dataset with 900 songs, each including audio features, release dates, genres, and popularity scores. We started our project by exploring ways to show the relationship between Spotify track popularity and audio features.Each point in our interactive scatter plot (1965–2020) represents a single track. The visualization highlights the genre differences.
Users can hover over points to see the artist, genre, valence, album cover, and a Spotify link. A year slider filters by release date, while a "Show All Years" toggle displays the full dataset.
One thing that was surprisingly hard was dealing with the tooltip interaction. Since there’s a lot of points that lay on the bottom right corner, we had to play around with how to move the tooltip accordingly.
One thing that was surprisingly fun…
The insights that emerged from the overlapping colors in different areas of the chart, which revealed general trends for various genres.
Link to the interactive visualization:
https://observablehq.com/d/b01eb889c8f922f0
CovidChrono (eam2316, hz2995, jx2515, yy3204)
An interactive graph that displays the trends in cases and deaths for each state in a 7-day average span using color. Blue is for cases and red is deaths. Users are allowed to click on states and have a more deeper look into the 7-day span.
One thing that was surprisingly hard was creating the map.
One thing that was surprisingly fun seeing the colors get lighter and darker on the states for the trends.
Link to the interactive visualization:
https://observablehq.com/d/86339c808367d8d0
Questions?
Next Class…
Draw in 30 seconds: Where did you go for break?
(not to scale!)
1hr
1-3hr
3-6hr
6-24hr
24+hr
A lot of days
Draw yourself: How much time did you spend on travel over spring break?
0 hours