• Applied Data Visualization (with R)
  • Preface
  • 1 About this workshop
    • 1.1 About me
    • 1.2 Your turn
    • 1.3 Workshop: Contact & Outline & Dates
    • 1.4 Workshop: Script & Material
    • 1.5 Workshop: Online vs. offline
    • 1.6 Workshop: Goals (1)
    • 1.7 Workshop: Goals (2)
    • 1.8 Workshop: Literature
    • 1.9 Workshop: Software we will use
    • 1.10 Workshop: Classifications = structure? (1)
    • 1.11 Workshop: Classifications = structure? (2)
    • 1.12 Great resources
  • 2 Introduction
    • 2.1 What is data visualization?
    • 2.2 Why visualize? Anscombes’s quartet (1)
    • 2.3 Why visualize? Anscombes’s quartet (2)
    • 2.4 Why visualize? Anscombes’s quartet (3)
    • 2.5 Why visualize? The Datasaurus Dozen
    • 2.6 The “best” graph ever drawn
      • 2.6.1 What is a good graph?
      • 2.6.2 The graph
      • 2.6.3 Modern version
      • 2.6.4 Tufte’s view: What can we learn from it?
    • 2.7 Why visualize? Further examples
    • 2.8 Summary: What did we learn so far?
  • 3 Quality of Graphs
    • 3.1 Criteria?
    • 3.2 Aims: Exploration vs. Explanation/Presentation
    • 3.3 Edward Tufte
    • 3.4 Graphical displays should…
    • 3.5 Principals of graphical excellence
    • 3.6 Graphical integrity: Example & exercise (1)
    • 3.7 Graphical integrity: Example & exercise (1)
    • 3.8 Graphical integrity
    • 3.9 Theory of data graphics (ToDG): Data-ink and graphical re-design
    • 3.10 ToDG: Data-ink Exercise 1
    • 3.11 ToDG Data-ink Exercise 1 (Solution)
    • 3.12 ToDG: Data-ink Exercise 2
    • 3.13 ToDG: Data-ink Exercise 2 (Solution)
    • 3.14 ToDG: Principles
    • 3.15 ToDG: Data density and small multiples (1)
    • 3.16 ToDG: Data density and small multiples (2): Exercise
    • 3.17 ToDG: Data density and small multiples (3)
    • 3.18 ToDG: Aesthetics and Technique in Graphical Design (1)
    • 3.19 ToDG: Aesthetics and Technique in Graphical Design (2)
    • 3.20 ToDG: Design is choice
    • 3.21 Perception/decoding: Edges, contrasts and colors
    • 3.22 Perception/decoding: Color models RGB (1)
    • 3.23 Perception/decoding: Color models HCL (2)
    • 3.24 Perception/decoding: Color Exercise (3)
    • 3.25 Perception/decoding: Color (4)
    • 3.26 Perception/decoding: Preattentive search & patterns
    • 3.27 Perception/decoding: Visual tasks
    • 3.28 Perception/decoding: Visual tasks and channels/mappings
    • 3.29 Perception/decoding: Visual tasks and channels/mappings
    • 3.30 Perception/decoding: Visual tasks and channels/mappings
    • 3.31 Perception: Acceptability principles
    • 3.32 Solution? Spelling = grammar = poetry?
    • 3.33 Summary
    • 3.34 Quality check questions
  • 4 Grammar of graphics & Ggplot2
    • 4.1 Grammar
    • 4.2 Grammar components & ggplot2 (1)
    • 4.3 Grammar components & ggplot2 (2)
    • 4.4 Grammar doesn’t
    • 4.5 Steps of visualizing
    • 4.6 Explore ggplot2 object: Exercise
    • 4.7 Data underlying graphs
    • 4.8 Data, aesthetics mappings and layers: Exercise 1
    • 4.9 Data, aesthetics mappings and layers: Exercise 2
    • 4.10 Various geoms
    • 4.11 Aesthetic Attributes: Color, Size, Shape (1)
    • 4.12 Aesthetic Attributes: Color, Size, Shape (2)
    • 4.13 Aesthetic Attributes: Exercise (1)
    • 4.14 Aesthetic Attributes: Exercise (2)
    • 4.15 Lab: Labels & Annotations (1)
    • 4.16 Labels & Annotations (2)
    • 4.17 Labels & Annotations: Exercise (3)
    • 4.18 Facetting (1)
    • 4.19 Facetting: Exercise (2)
    • 4.20 Axes
    • 4.21 Axes: Exercise
    • 4.22 Output
    • 4.23 Interactive
  • 5 Visualizing for description
    • 5.1 Exploratory summary graphs
      • 5.1.1 Lab: Data & Code
    • 5.2 Summary statistics/graphs for a paper
      • 5.2.1 Data & Packages & functions
      • 5.2.2 Graph
      • 5.2.3 Lab: Data & Code
      • 5.2.4 Exercise
    • 5.3 Barplot: Unsummarized vs. summarized data
    • 5.4 Categorical variables (2+)
      • 5.4.1 Data & Packages & functions
      • 5.4.2 Graph
      • 5.4.3 Lab: Data & Code
      • 5.4.4 Exercise
    • 5.5 Numeric vs. categorical: Various plot types
      • 5.5.1 Data & Packages & functions
      • 5.5.2 Graph
      • 5.5.3 Lab: Data & Code
    • 5.6 Numeric vs. various variables
      • 5.6.1 Lab: Data & Code
    • 5.7 Numeric vs. numeric: Correlograms
      • 5.7.1 Data & Packages & functions
      • 5.7.2 Graph
      • 5.7.3 Lab: Data & Code
    • 5.8 Numeric vs. numeric: Scatterplots + smoother
      • 5.8.1 Data & Packages & functions
      • 5.8.2 Graph
      • 5.8.3 Lab: Data & Code
    • 5.9 Time: Line charts & events
      • 5.9.1 Data & Packages & functions
      • 5.9.2 Graph
      • 5.9.3 Lab: Data & code
      • 5.9.4 Exercise
    • 5.10 Time: Wave participation & time-point presence
      • 5.10.1 Data & Packages & functions
      • 5.10.2 Graph
      • 5.10.3 Lab: Data & Code
      • 5.10.4 Exercise
    • 5.11 Time: Means across time (or other categories)
      • 5.11.1 Data & Packages & functions
      • 5.11.2 Graph
      • 5.11.3 Lab: Data & Code
    • 5.12 Time: Slope charts
      • 5.12.1 Data & Packages & functions
      • 5.12.2 Graph(s)
      • 5.12.3 Lab: Data & Code
  • 6 Visualizing statistical results
    • 6.1 Data & Packages & functions
    • 6.2 Graph: Coefficient plots
      • 6.2.1 Lab: Data & code
    • 6.3 Exercise
    • 6.4 Graph: Coefficient plots with facetting
      • 6.4.1 Lab: Data & code
    • 6.5 Coefficient plots: Coloring
      • 6.5.1 Lab: Data & code
    • 6.6 Graph: Coefficient plots with facetting and coloring
      • 6.6.1 Lab: Data & code
    • 6.7 Graph: Predicted values
      • 6.7.1 Lab: Data & code
    • 6.8 Useful graphs & resources
  • 7 Visualizing geographic data
    • 7.1 Geographic data: Vector boundaries & Area metadata
    • 7.2 Geographic data: Point metadata
    • 7.3 Geographic data: Raster image
    • 7.4 Packages & functions
    • 7.5 Graph
      • 7.5.1 Lab: Data & Code
    • 7.6 Exercise
  • 8 Animations & movies
    • 8.1 Packages
    • 8.2 Concepts
    • 8.3 Concepts: Rendering
    • 8.4 Graph
    • 8.5 Lab: Data & code
    • 8.6 Exercise
  • 9 Interactive data visualization: Intro & theory
    • 9.1 Readings
    • 9.2 Some interactive visualizations
    • 9.3 Interactivity: Theory & Concepts
    • 9.4 Elements of a graph
    • 9.5 Elements & Interactivity
    • 9.6 Some concepts of interaction
      • 9.6.1 Example/Exercise (1)
      • 9.6.2 Example/Exercise (2)
    • 9.7 Data
    • 9.8 Data: Subsetting
    • 9.9 Data: Manipulation/Creation
    • 9.10 Tools
  • 10 Interactive data visualization: Plotly
    • 10.1 What is Plotly?
    • 10.2 Example(s) for starters
    • 10.3 Interactive elements
    • 10.4 Basic workings
    • 10.5 Basic functions
    • 10.6 Two ways of setup
    • 10.7 Plot types: Basic 2D
    • 10.8 Layout
    • 10.9 Layout: Margins
    • 10.10 Layout: Axes
    • 10.11 Exercise: Layout and basic plot types
    • 10.12 Markers & Lines: Symbols
    • 10.13 Markers
    • 10.14 Lines
    • 10.15 Shapes: Circles etc.
    • 10.16 Colouring data: Continuous
    • 10.17 Colouring data: Categories
    • 10.18 Exercise: Markers & Colours
    • 10.19 Legends
    • 10.20 Annotations: Dynamic
    • 10.21 Annotations: Static
    • 10.22 Exporting/Saving Graphs
    • 10.23 Small multiples (1)
    • 10.24 Small multiples (2)
    • 10.25 Exercise: Dynamic annotations and small multiples
  • 11 Interactive data visualization: Shiny
    • 11.1 What is Shiny?
    • 11.2 Setting up shinyapps.io
    • 11.3 Example for starters
    • 11.4 Basic steps
    • 11.5 UI: Layout
    • 11.6 UI: Layout advanced
      • 11.6.1 tabsetPanel and tabPanel
      • 11.6.2 HTML tag functions
      • 11.6.3 Images
    • 11.7 UI: Control widgets/inputs (1)
    • 11.8 UI: Control widgets/inputs Exercise (2)
    • 11.9 UI: Outputs (reactivity)
    • 11.10 SERVER
    • 11.11 SERVER: Example
    • 11.12 Exercise: SERVER
    • 11.13 Summary
    • 11.14 LOADING THINGS (1)
    • 11.15 LOADING THINGS (2)
    • 11.16 Exercise
    • 11.17 Example: A simple regression app
  • 12 COMBINING Shiny and Plotly
    • 12.1 A simple example
  • 13 Appendix
    • 13.1 Line vs. path plots
    • 13.2 Add notes directly to plot
    • 13.3 Plotly: Scatterplot matrices
    • 13.4 Plotly: Boxplots
    • 13.5 Plotly: Visualizing statistical results
      • 13.5.1 Dotplots & error bars
      • 13.5.2 Exercise: Dotplots & error bars
    • 13.6 Plotly: Ribbons (confidence intervalls)
      • 13.6.1 Exercise: Ribbons (1)
      • 13.6.2 Exercise: Ribbons (2)
    • 13.7 Plotly: Maps
      • 13.7.1 Example
    • 13.8 Plotly 3D
      • 13.8.1 3D Layout
    • 13.9 Some more ressources
    • 13.10 Writing functions to plot
    • 13.11 Problems I encountered
    • 13.12 Creating ggplots in loops
    • 13.13 Other visualizations
    • 13.14
  • 14 References
  • References
  • Published with bookdown

GESIS Workshop: Applied Data Visualization

11.8 UI: Control widgets/inputs Exercise (2)

  1. Build a shiny user interface/layout with the control widgets figured below (!new style!)
    • Tipp: Widgets have to be separated by commas.

#ui.R
ui <- fluidPage(
  titlePanel("Widgets in the sidebar"),
  sidebarLayout(
    sidebarPanel(
      selectInput("select", label = h3("Select box"),
                  choices = list("Choice 1" = 1, "Choice 2" = 2,
                                 "Choice 3" = 3), selected = 1),

      sliderInput("slider", label = h3("Range (Slider)"),
                  min = 0, max = 100, value = c(25, 75))
    ),
    mainPanel("In the sidebar on the left we find two widgets that can be used to send messages to the app by the user.")
  )
)

server <- function(input, output) {}
shinyApp(ui=ui, server = server)