About

This website serves as slides and script for the GESIS workshop Applied Data Visualization, for the seminar Datenvisualisiserung für Politikwissenschafter (Universität Freiburg) as well as for workshops in other, shorter formats taught by Paul C. Bauer .1 Original material is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license. Where I draw on other authors material (I do so extensively) other licenses may apply. Please note the references in the syllabus as well as the citations and links in the script. For potential future versions of this material see www.paulcbauer.de. If you have feedback or discover errors/dead links please let me know (mail@paulcbauer.de). And make sure to install all the necessary packages before you use the script.

1 Versions: Workshops & Seminars

  • Seminar at University of Freiburg (18h teaching hours in total): Siehe Syllabus.
  • Gesis: 4 days (18h in total): This GESIS version lasts 18 ours across 4 days and cover almost all of the content in the script. Different foki are set depending on participants demands.
    • Hours: 10:00 - 12:00 and 13:00 - 15:30
    • Dates, Contact and Outline: See syllabus (received link via email).
  • Wuppertal: 1 day (7h in total)
    • 2 Introduction; 3 Quality of Graphs (Skip 4, 5); 4 Grammar of graphics; 5 Visualizing descriptive statistics (1-4); 6 Visualizing statistical models (1-5); 9 Interactive data visualization (intro, theory, plotly)
    • Hours: 9:00 - 12:00 and 13:00 - 17:00 (1 hour lunch break and shorter breaks inbetween)
  • Bremen: 1 day (7h in total)
    • 2 Introduction (skip 6/8); 3 Quality of Graphs (skip 5); 13 Academic posters, 4 Grammar of graphics; 5 Visualizing descriptive statistics (1-4); 6 Visualizing statistical models (1-4); 12 Visualizing text data; 9 Interactive data visualization (maybe Shiny/Plotly)
    • Hours: 9:00 - 12:00 and 13:00 - 17:00 (1 hour lunch break and shorter breaks inbetween)
  • I hope you are fine with the schedule?
    • Whenever you need a break let me know!

2 Instructor: About me

3 Your turn

  • Let’s check our the survey results…
  1. Name?
  2. Country? (Affiliation?)
  3. Discipline

4 Script & material

  • Literature: See syllabus.
  • Website/script: https://bookdown.org/paul/applied-data-visualization/
    • Find it: Google “applied data visualization paul”
    • Document = slides + script (Zoom in/out with STRG + mousewheel)
    • Code: can all be found in the script
    • Data: can usually be downloaded over links in the script. If not we’ll share the files.
    • Full screen: F11
    • Navigation: TOCs on left and right
    • Search document (upper left)
    • Document generated with quarto
  • Motivation: Have a go-to script for participants (and ourselves!)
  • Content: Mixture of theory, lab sessions, exercises and pure code examples for discussion

5 Online vs. offline

  • Negative
    • Screen fatigue
    • I can’t run around to check your code
    • Less engaging, less social
    • Voice
    • Screen sharing…
    • Less screen space than classroom
  • Positive
    • We see the graphs where they are mostly consumed ;-) (on a screen)
      • Remember: “How is your graph consumed (smartphone)?”
    • Participation from everywhere
  • Rule: Please keep your camera online!
    • Distracting animals/children/partners are a welcome distraction!
    • Yawning, leaving, looking bored etc. allowed!
    • Use a virtual background if you like!

6 Strategy & Goals/Learning outcomes

  • Hopefully you don’t expect too much (managing expectations!)
  • Data visualization has become a profession
  1. Learn some fundamental principles of (data) visualization
    • Theory of Data Graphics (Tufte)
    • Spotting bad and good graphs
    • Grammar of graphics (Cleveland, Wickham) & Ggplot
  2. Learn how to visualize in R
    • Making better graphs (for your publications/reports)
    • Learn different useful graphs for exploration & presentation
    • Explore simple descriptive graphs and more complicated graphs of statistical models (e.g., coefficient plots)
  3. Make first steps in interactive visualization (exploration!)
Good visualizations/graphs take time to create!

7 Software we will use

  • What software will we use?
  • Open-source software!
    • Q: What speaks for open-source software?
  • R (only viable competitor is Python)3
    • Script/exercise were built using R version 4.2.3 (2023-03-15 ucrt).
    • You can switch R versions in Rstudio.
    • Install the necessary packages using the code below.
# install.packages('pacman')
library(pacman)
p_load('gt',
'gtsummary', 'modelsummary', 'gifski', 'png', 'datasauRus',
'ggplot2', 'gganimate', 'dplyr', 'reshape2', 'eurostat',
'knitr', 'extrafont', 'ggtext', 'ggrepel', 'patchwork',
'ggpmisc', 'gtrendsR', 'ggnewscale', 'tidyverse',
'lubridate', 'broom', 'marginaleffects', 'ggmap',
'rnaturalearth', 'sf', 'plotly', 'shiny', 'lemon',
'kableExtra', 'randomNames', 'stargazer', 'gapminder',
'htmlwidgets', 'sparkline')
  • Ggplot24
    • Base R vs. Ggplot2 (e.g., 1, 2, 3)
    • I was in the “base R camp” but…
      • …came to ggplot over plotly (through this project)
      • Now a huge fan of ggplot2: Why? (Q: Latex? or R vs. C++)
      • And, there is a Python equivalent: Plotnine
  • Plotly5
  • Shiny: See other workshop
  • Note: Ideally cite the software you use in your research especially when it is open-source (see citation("ggplot2"))

8 Structure (1)

  • How to structure a dataviz workshop/seminar?!
  • Hard classify graphs/data visualizations
    • Description vs. explanation
    • Exploration vs. presentation
  • From data to viz
  • Awareness of different approaches → creativity/ideas
    • …the more graphs you have seen the better!
    • …go through different great examples.

9 Structure (2)

  • Distinctions are only so helpful… same graph can be used for exploration, description, explanation etc.
  • Rationale: What do we need in every-day work?
    • Grasp quality of graphs
    • Understand underlying logic: Research question → Data → Graph
    • Use graphs to describe data (simple summaries) and to visualize results of statistical models (t-tests, regressions etc.)
    • What is your story?
  • Structure of this workshop: See syllabus and TOC

10 Helpful resources

  1. https://www.r-graph-gallery.com/
    • Classification: Distribution; Correlation; Ranking; Part of whole; Evolution; Map; Flow
  2. https://www.data-to-viz.com/
  3. https://shiny.rstudio.com/gallery/
    • Gallery of shiny apps (most visualize data)
  4. A Compendium of Clean Graphs in R (base R)
  5. Michael Friendly’s website
  6. flowingdata.com
  7. R cheat sheets
  8. 1 dataset 100 visualizations
  9. Competitions (a few for inspiration…)

Footnotes

  1. The first iteration of the workshop was taught in May 2020.↩︎

  2. Check out some of Richard’s cool base R graphs from a recent workshop.↩︎

  3. Creators: Core contributors and thousands of package authors.↩︎

  4. Creators: https://github.com/tidyverse/ggplot2↩︎

  5. Creators: https://github.com/plotly/plotly.js; https://github.com/ropensci/plotly↩︎