class: middle, center, title-slide # Introduction ## STAE04: Data Visualization ### Johan Larsson ### The Department of Statistics, Lund University --- class: section-title # Why visualize? --- class: middle, center <img src="01-introduction_files/figure-html/unnamed-chunk-1-1.svg" style="display: block; margin: auto;" /> .footnote[ <a name=cite-reinsel2018></a>[Reinsel, Gantz, and Rydning (2018)](#bib-reinsel2018) ] --- class: center, middle <div class="figure" style="text-align: center"> <img src="01-introduction_files/figure-html/unnamed-chunk-2-1.svg" alt="Interest in data visualization as a fraction of the maximum interest recorderd (using Google Trends). The blue line represents a moving average." /> <p class="caption">Interest in data visualization as a fraction of the maximum interest recorderd (using Google Trends). The blue line represents a moving average.</p> </div> --- ## Visualization as communication * main goal is to **communicate** patterns in data * we are wired to learn from **seeing** -- <div class="figure" style="text-align: center"> <img src="images/napoleon.png" alt="Charles Minard's visualization of Napoleon's Russian campaign of 1812." width="2560" height="30%" /> <p class="caption">Charles Minard's visualization of Napoleon's Russian campaign of 1812.</p> </div> --- class: center, middle .pull-left[ <table class="table" style="font-size: 13px; margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:left;"> region </th> <th style="text-align:right;"> employment (%) </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Stockholms län </td> <td style="text-align:right;"> 72.7 </td> </tr> <tr> <td style="text-align:left;"> Hallands län </td> <td style="text-align:right;"> 72.1 </td> </tr> <tr> <td style="text-align:left;"> Jönköpings län </td> <td style="text-align:right;"> 70.9 </td> </tr> <tr> <td style="text-align:left;"> Västra Götalands län </td> <td style="text-align:right;"> 70.0 </td> </tr> <tr> <td style="text-align:left;"> Kronobergs län </td> <td style="text-align:right;"> 69.3 </td> </tr> <tr> <td style="text-align:left;"> Uppsala län </td> <td style="text-align:right;"> 68.4 </td> </tr> <tr> <td style="text-align:left;"> Gotlands län </td> <td style="text-align:right;"> 68.2 </td> </tr> <tr> <td style="text-align:left;"> Östergötlands län </td> <td style="text-align:right;"> 67.4 </td> </tr> <tr> <td style="text-align:left;"> Värmlands län </td> <td style="text-align:right;"> 67.1 </td> </tr> <tr> <td style="text-align:left;"> Jämtlands län </td> <td style="text-align:right;"> 66.2 </td> </tr> <tr> <td style="text-align:left;"> Örebro län </td> <td style="text-align:right;"> 66.0 </td> </tr> <tr> <td style="text-align:left;"> Västmanlands län </td> <td style="text-align:right;"> 65.7 </td> </tr> <tr> <td style="text-align:left;"> Gävleborgs län </td> <td style="text-align:right;"> 65.0 </td> </tr> <tr> <td style="text-align:left;"> Västerbottens län </td> <td style="text-align:right;"> 64.9 </td> </tr> <tr> <td style="text-align:left;"> Kalmar län </td> <td style="text-align:right;"> 64.9 </td> </tr> <tr> <td style="text-align:left;"> Skåne län </td> <td style="text-align:right;"> 64.8 </td> </tr> <tr> <td style="text-align:left;"> Dalarnas län </td> <td style="text-align:right;"> 64.7 </td> </tr> <tr> <td style="text-align:left;"> Västernorrlands län </td> <td style="text-align:right;"> 64.6 </td> </tr> <tr> <td style="text-align:left;"> Blekinge län </td> <td style="text-align:right;"> 63.9 </td> </tr> <tr> <td style="text-align:left;"> Norrbottens län </td> <td style="text-align:right;"> 62.9 </td> </tr> <tr> <td style="text-align:left;"> Södermanlands län </td> <td style="text-align:right;"> 62.8 </td> </tr> </tbody> </table> ] -- class: center, middle .pull-right[ <img src="01-introduction_files/figure-html/unnamed-chunk-5-1.svg" style="display: block; margin: auto;" /> ] --- class: section-title # An example ## GDP per capita and life expectancy across time --- ## First attempt <img src="01-introduction_files/figure-html/unnamed-chunk-6-1.svg" style="display: block; margin: auto;" /> --- ## Transforming the axis <img src="01-introduction_files/figure-html/unnamed-chunk-7-1.svg" style="display: block; margin: auto;" /> --- ## Grouping time, adding population <img src="01-introduction_files/figure-html/unnamed-chunk-8-1.svg" style="display: block; margin: auto;" /> --- ## Animated plots (using **gganimate**) <img src="01-introduction_files/figure-html/unnamed-chunk-9-1.gif" style="display: block; margin: auto;" /> --- class: section-title # Learning outcomes --- ## Knowledge and understanding * demonstrate knowledge of the theoretical and practical construction of visualisations, and * demonstrate understanding of how the type of data impacts the visualisation and what components are appropriate. -- ## Competence and skills * demonstrate the skill to independently, using software, visualise various types of data, * demonstrate the ability to make appropriate choices in designing visualisations, and * demonstrate the ability to in writing present and discuss visualisations in dialogue with others. --- ## Judgement and approach * demonstrate the ability to assess visualisations with respect to clarity, accessibility and ethics, and * demonstrate insight into the importance of the design of visualisations with respect to communicative properties, accessibility and ethics. --- class: section-title # Course structure --- ## Topics * introduction to R and R Studio * introduction to ggplot2 * basics of data visualizations * visualizations with one variable * visualizations with several variables * maps * interactive and animated visualizations --- ## Learning activities * lectures * text * worked examples --- ## Examination ### Assessment * quizzes * assignments * project .pull-left[ ### Peer feedback the assignment and project will be reviewed through peer-feedback ] .pull-right[ <img src="images/feedback.jpg" width="2400" style="display: block; margin: auto;" /> ] --- .pull-left[ ## Course literature * Data visualization: Charts, Maps, and Interactive Graphics <a name=cite-grant2018></a>([Grant, 2018](#bib-grant2018)). Available through LUBsearch. * A Layered Grammar of Graphics <a name=cite-wickham2010></a>([Wickham, 2010](http://www.tandfonline.com/doi/abs/10.1198/jcgs.2009.07098)). Available online for free. ] .pull-right[ <img src="images/grant-book.jpg" width="70%" style="display: block; margin: auto;" /> ] -- ## Other resources * [stackoverflow.com](https://stackoverflow.com/) (tag: ggplot2) * R Graphics Cookbook <a name=cite-chang2013></a>([Chang, 2013](#bib-chang2013)). Abbreviated version available online at <http://www.cookbook-r.com/Graphs/>, but it might be somewhat outdated. --- class: section-title # Good luck! --- ## References <a name=bib-chang2013></a>[Chang, W.](#cite-chang2013) (2013). _R Graphics Cookbook: Practical Recipes for Visualizing Data_. 1 edition. Beijing Cambridge Farnham Köln Sebastopol Tokyo: O'Reilly Media. 416 pp. ISBN: 978-1-4493-1695-2. <a name=bib-grant2018></a>[Grant, R.](#cite-grant2018) (2018). _Data Visualization: Charts, Maps, and Interactive Graphics_. 1 edition. Boca Raton: Chapman and Hall/CRC. 248 pp. ISBN: 978-1-138-70760-3. <a name=bib-reinsel2018></a>[Reinsel, D., J. Gantz, and J. Rydning](#cite-reinsel2018) (2018). _The Digitization of the World: From Edge to Core_. US44413318. MA, USA: IDC, p. 28. <a name=bib-wickham2010></a>[Wickham, H.](#cite-wickham2010) (2010). "A Layered Grammar of Graphics". In: _Journal of computational and graphical statistics_ 19.1, pp. 3-28. ISSN: 1061-8600. DOI: [10.1198/jcgs.2009.07098](https://doi.org/10.1198%2Fjcgs.2009.07098). URL: [http://www.tandfonline.com/doi/abs/10.1198/jcgs.2009.07098](http://www.tandfonline.com/doi/abs/10.1198/jcgs.2009.07098) (visited on mar. 13, 2020).