class: center, middle, inverse # Data Viz <img src="img/hero_wall_pink.png" width="800px"/> ## Kelly McConville .large[Math 241 | Week 1 | Spring 2021] --- # Announcements * Make sure [to sign-in](https://docs.google.com/document/d/1QMXSF9TxsXj3j8M42mwTatGnB_-GayYvGmHWnnXd-sg/edit?usp=sharing) and denote if on the waitlist. * Complete the [Initial Participation Assignment](https://docs.google.com/document/d/1jGeyMz1TH_axOZOhHr-04XKrt1AW3PHyFJXCLKs_ffU/edit?usp=sharing). * Complete the Week 1 Readings: (by end of the week) * What is Data Science? + Reading: MDSR Ch 1.1 * Data Journalism + Reading: CJGD Executive Summary and Introduction * Data Visualization Principles + Reading: MDSR Ch 2.1 - 2.4 --- ## Goals for Today * Develop the language to talk about the components of a graphic. * Practice deconstructing graphics. * Discuss good graphical practices. * Great resource: + Nathan Yau's [work](https://flowingdata.com/books/) --- ## Components of Data Graphics * **data**: dataset that contains the raw data * **geom**: geometric shape that the data are mapped to. + point, line, bar, text, ... * **aes**thetic: visual properties of the **geom** + x position, y position, color, fill, shape * **coord**: coordinate system + Cartesian, polar * **scale**: controls how data are mapped to the visual values of the aesthetic. + EX: particular colors, linear * **guide**: legend to help user convert visual display back to the data --- ## Geoms versus Names * What are the names of these graphs? <img src="img/bars.png" width="100%" style="display: block; margin: auto;" /> * Today I want us to focus on the **shapes** (i.e. geoms) and how the variables are **mapped** to those shapes. --- ## Aesthetics What aesthetics do we have to play around with? * Position * Size + Length + Area + Volume + Angle * Shapes * Color + Saturation + Hue --- ##Aesthetics: [Position](https://fivethirtyeight.com/features/a-nerds-guide-to-the-2229-paintings-at-moma/) <img src="img/moma.png" width="80%" style="display: block; margin: auto;" /> --- ##Aesthetics: [Length](https://www.nature.com/articles/d41586-019-03305-w) <img src="img/female_authors.png" width="70%" style="display: block; margin: auto;" /> Hat tip: Grace Benson --- ##Aesthetics: [Area](https://www.nytimes.com/2018/09/25/learning/whats-going-on-in-this-graph-sept-26-2018.html) <img src="img/area.png" width="100%" style="display: block; margin: auto;" /> --- ##Aesthetics: [Angle](https://flowingdata.com/2008/09/19/pie-i-have-eaten-and-pie-i-have-not-eaten/) <img src="img/pie.png" width="50%" style="display: block; margin: auto;" /> --- ##Aesthetics: [Shapes](https://www.informationisbeautiful.net/visualizations/best-in-show-whats-the-top-data-dog/) <img src="img/dogs.png" width="90%" style="display: block; margin: auto;" /> Hat Tip: Elin Hansen --- ##Aesthetics: [Color Shade](https://roadtolarissa.com/nba-minutes/) <img src="img/nba_2015.png" width="100%" style="display: block; margin: auto;" /> --- ##Aesthetics: [Color Hue](https://fivethirtyeight.com/features/the-five-types-of-nicolas-cage-movies/) <img src="img/nic_cage.png" width="60%" style="display: block; margin: auto;" /> --- ## [Which represents the larger value?](http://stat405.had.co.nz/lectures/20-effective-vis.pdf) <div class="figure" style="text-align: center"> <img src="img/larger1.png" alt="From Wickham (2012)" width="80%" /> <p class="caption">From Wickham (2012)</p> </div> --- ## [Which represents the larger value?](http://stat405.had.co.nz/lectures/20-effective-vis.pdf) <div class="figure" style="text-align: center"> <img src="img/larger2.png" alt="From Wickham (2012)" width="80%" /> <p class="caption">From Wickham (2012)</p> </div> --- ## [Which represents the larger value?](http://stat405.had.co.nz/lectures/20-effective-vis.pdf) <div class="figure" style="text-align: center"> <img src="img/larger3.png" alt="From Wickham (2012)" width="80%" /> <p class="caption">From Wickham (2012)</p> </div> --- ## [Which represents the larger value?](http://stat405.had.co.nz/lectures/20-effective-vis.pdf) <div class="figure" style="text-align: center"> <img src="img/larger4.png" alt="From Wickham (2012)" width="80%" /> <p class="caption">From Wickham (2012)</p> </div> --- ## [Which represents the larger value?](http://stat405.had.co.nz/lectures/20-effective-vis.pdf) <div class="figure" style="text-align: center"> <img src="img/larger5.png" alt="From Wickham (2012)" width="80%" /> <p class="caption">From Wickham (2012)</p> </div> --- ## [Which represents the larger value?](http://stat405.had.co.nz/lectures/20-effective-vis.pdf) <div class="figure" style="text-align: center"> <img src="img/larger7.png" alt="From Wickham (2012)" width="80%" /> <p class="caption">From Wickham (2012)</p> </div> --- ## Aesthetics **Which of these are ordinal/quantitative?** * Position * Size + Length + Area + Volume + Angle * Shapes * Color + Shade/Saturation + Hue --- ## [Data Viz Example](https://www.nytimes.com/2019/04/11/learning/whats-going-on-in-this-graph-april-17-2019.html) .left-column[ * Variable(s)? * Geom(s)? * **Aesthetic**s of the **geom**? + Mapping of variables? * Additional context? ] .right-column[ <img src="img/baseball.png" width="100%" style="display: block; margin: auto;" /> ] --- ## [Data Viz Example](https://www.nytimes.com/2018/09/18/learning/whats-going-on-in-this-graph-sept-19-2018.html) .left-column[ * Variable(s)? * Geom(s)? * **Aesthetic**s of the **geom**? + Mapping of variables? * Additional context? ] .right-column[ <img src="img/disaster.png" width="100%" style="display: block; margin: auto;" /> ] --- ## [Data Viz Example](https://www.nytimes.com/2020/01/23/learning/whats-going-on-in-this-graph-jan-29-2020.html) .left-column[ * Variable(s)? * Geom(s)? * **Aesthetic**s of the **geom**? + Mapping of variables? * Coordinate system? * Additional context? ] .right-column[ <img src="img/sport_injuries.png" width="100%" style="display: block; margin: auto;" /> ] --- ## [Data Viz Example](https://www.nytimes.com/interactive/2018/01/23/climate/trump-offshore-oil-drilling.html) .left-column[ * Variable(s)? * Geom(s)? * **Aesthetic**s of the **geom**? + Mapping of variables? * Coordinate system? * Additional context? ] .right-column[ <img src="img/oil_graphic.png" width="95%" style="display: block; margin: auto;" /> ] --- ##Scales <img src="img/scales.jpg" width="70%" style="display: block; margin: auto;" /> --- ##Scales [Example](https://fivethirtyeight.com/features/fairness-vs-freedom-is-politics-going-back-to-the-1970s/) <img src="img/fairness_freedom.png" width="55%" style="display: block; margin: auto;" /> --- ### Considerations: [Proportional Ink](https://www.businessinsider.com/the-top-10-most-read-books-in-the-world-infographic-2012-12) **Principle of proportional ink:** The size of shaded areas need to be proportional to the data values they represent. <img src="img/books.png" width="60%" style="display: block; margin: auto;" /> -- * Bars on a linear scale should start at 0. --- ### Considerations: [Proportional Ink](https://www.nytimes.com/2020/10/08/learning/whats-going-on-in-this-graph-consumer-spending-during-the-pandemic.html) **Principle of proportional ink:** The size of shared areas need to be proportional to the data values they represent. <img src="img/spending.png" width="60%" style="display: block; margin: auto;" /> * Bars on a linear scale should start at 0. --- ### Considerations: [Supporting Text](https://fivethirtyeight.com/features/what-ruth-bader-ginsburgs-death-could-mean-for-2020-and-the-supreme-court/) .pull-left[ Consider including: * Title (or Figure Caption) * Subtitle * Axis labels (with units) ] .pull-right[ * Legends/helpers (with units) * Maker * Data Source * Key points ] <img src="img/rbg.png" width="95%" style="display: block; margin: auto;" /> --- ### Considerations: [Context, Context, Context!](https://www.nytimes.com/2020/01/23/learning/whats-going-on-in-this-graph-jan-29-2020.html) <img src="img/sport_injuries.png" width="90%" style="display: block; margin: auto;" /> --- ### Considerations: [Simplifying by Faceting](https://fivethirtyeight.com/features/ted-cruzs-general-election-strategy-is-wishful-thinking/) * Great way to add another variable without over-complicating your graphic. <img src="img/vote_more.png" width="50%" style="display: block; margin: auto;" /> --- ### Considerations: [Color Palettes](https://colorbrewer2.org) **Sequential**: Ordered data with one direction <img src="img/cb_seq.png" width="80%" style="display: block; margin: auto;" /> --- ### Considerations: [Color Palettes](https://colorbrewer2.org) **Diverging**: Ordered data with two directions <img src="img/cb_div.png" width="80%" style="display: block; margin: auto;" /> --- ### Considerations: [Color Palettes](https://colorbrewer2.org) **Qualitative**: No order to the data <img src="img/cb_qual.png" width="80%" style="display: block; margin: auto;" /> --- ### Considerations: Color Palettes Which type(s)? <img src="img/climate_change.png" width="900%" style="display: block; margin: auto;" /> --- ### Common R Color Palettes <img src="img/color_palettes.png" width="70%" style="display: block; margin: auto;" /> * Easy to see differences? * Perceptually uniform? * Robust to colorblindness? * Pretty? --- ### Color Blindness: Red-Blind <img src="img/red_blind.png" width="70%" style="display: block; margin: auto;" /> --- ### Color Blindness: Green-Blind <img src="img/green_blind.png" width="70%" style="display: block; margin: auto;" /> --- ### Considerations: [Aspect Ratio](http://socviz.co/lookatdata.html) * Aspect ratio affects our perception of the rate of change <img src="img/aspect_ratio.png" width="80%" style="display: block; margin: auto;" /> --- ### Considerations: [Make Important Comparisons Easy](https://serialmentor.com/dataviz/visualizing-proportions.html) * Which graph makes it easy to conclude that the ruling coalition (FDP + SPD) have a majority? <div class="figure" style="text-align: center"> <img src="img/bundestag.png" alt="Wilke (2019)" width="80%" /> <p class="caption">Wilke (2019)</p> </div> --- ### Considerations: [Make Important Comparisons Easy](https://serialmentor.com/dataviz/visualizing-proportions.html) * Which graph makes it easy to see how a company's market share changes over time? (Warning: Fake data.) <div class="figure" style="text-align: center"> <img src="img/trend.png" alt="Wilke (2019)" width="80%" /> <p class="caption">Wilke (2019)</p> </div> --- ## Time to Practice * Let's practice spotting the geometric object and the mapping of the variables! * In the article ["One Dataset, Visualized 25 Ways"](https://flowingdata.com/2017/01/24/one-dataset-visualized-25-ways/#jp-carousel-47350) Nathan Yau presents several graphs of life expectancy data from the World Health Organization. + For each graph, we want to identify how the variables are mapped to the aesthetics of the geometric objects (i.e. shapes) and to consider how well (or not well) it is at telling a story + [Make a copy of the hand-out](https://docs.google.com/document/d/13vqvJegm8o-29sLo_hMgKslphqfJH-rvEh8FAQBlcYs/copy). + Before next class we ready to identify which one(s) you think are most effective at telling a story.