ETC5523: Communicating with Data

Narrative

Lecturer: Michael Lydeamore

Department of Econometrics and Business Statistics



Aim

  • Compose effective data stories by:
    • identifying the goals,
    • selecting appropriate data, visualisations and aesthetic designs, and
    • receiving feedback.
  • Understand and apply narrative structures and techniques to enhance communication with data

Recall: Communication is a process

Transactional communication model

Communication problems

The technical problem

How accurately can the symbols of communication be transmitted?

The semantic problem

How precisely do the transmitted symbols convey the desired meaning?

The effectiveness problem

How effectively does the received meaning affect conduct in the desired way?

Principles of Communicating Data

  1. Know your goal (target audience, intended message, desired effect)
  2. Use the right data
  3. Select suitable visualisations
  4. Design for aesthetics
  5. Choose an effective medium and channel
  6. Check the results, i.e. get feedback

Recall: Communicating with Data

Recall: Rhetorics

  • The art of effective or persuasive speaking or writing

Rhetorical triangle

Rhetorical situation

  • Writer or Speaker
  • Purpose
  • Message
  • Audience
  • Context



No one ever made a decision because of a number. They need a story.

– Daniel Kahneman

Basic Story Types

One Story Type

Conflict

Seven Story Types

  1. Overcoming the monster
  2. Rags to riches
  3. The quest
  4. Voyage and return
  5. Comedy
  6. Tragedy
  7. Rebirth

Twenty Story Types

  1. Quest
  2. Adventure
  3. Pursuit
  4. Rescue
  5. Escape
  6. Revenge
  7. The Riddle
  1. Rivalry
  2. Underdog
  3. Temptation
  4. Metamorphosis
  5. Transformation
  6. Maturation
  7. Love
  1. Forbidden Love
  2. Sacrifice
  3. Discovery
  4. Wretched Excess
  5. Ascension
  6. Descension.

Basic Data Story Types

Data Story Types

Data: key crop yields

# devtools::install_github("etc5523-2022/data", ref = "tut9")
cwdata::key_crop_yields
# A tibble: 143,825 × 5
   entity      code   year crop     yield
   <chr>       <chr> <dbl> <chr>    <dbl>
 1 Afghanistan AFG    1961 wheat     1.02
 2 Afghanistan AFG    1961 rice      1.52
 3 Afghanistan AFG    1961 maize     1.4 
 4 Afghanistan AFG    1961 soybeans NA   
 5 Afghanistan AFG    1961 potatoes  8.67
 6 Afghanistan AFG    1961 beans    NA   
 7 Afghanistan AFG    1961 peas     NA   
 8 Afghanistan AFG    1961 cassava  NA   
 9 Afghanistan AFG    1961 barley    1.08
10 Afghanistan AFG    1961 cocoa    NA   
# ℹ 143,815 more rows

One data, many stories

Change over time

Drill down

Contrast

Factors

Intersections

Outliers

Kuwait, NZ & USA have highest potato yields, 2018

Narrative structure

Narrative structure

Elements of statistical persuasion

  • Magnitude of effects: the strength of a statistical argument is enhanced in accord with the quantitative magnitude of support for its qualitative claim.
  • Articulation of results: the degree of comprehensible detail in which conclusions are phrased.
  • Generality of effects: the replicability of the results.
  • Interestingness of argument: the potential to change people believe.
  • Credibility of argument: the believability of a claim.

Narrative techniques

  • Metaphor, simile, analogy or anecdotes, e.g. “one in three households is wasting the equivalent of a shopping bag full of food each week.”
  • Comparisons, e.g. “While the average Australian man has $52,786 in their savings account right now, the average woman sits at around half that figure – $26,132.”
  • Flow of information, e.g. new information before old, simple before complex information.

Improving communication

Feedback loops

  • Recall there is no single, ideal way to communicate.
  • Get in a habit to seek feedback from others about:
    • Reach: Did the audience even receive your message at all? Who did and who didn’t?
    • Understanding: Did the audience interpret the data message in the way you intended?
    • Impact: Did the audience react in the way you wanted them to react?

Anscombe’s Quartet

x1 x2 x3 x4 y1 y2 y3 y4
10 10 10 8 8.04 9.14 7.46 6.58
8 8 8 8 6.95 8.14 6.77 5.76
13 13 13 8 7.58 8.74 12.74 7.71
9 9 9 8 8.81 8.77 7.11 8.84
11 11 11 8 8.33 9.26 7.81 8.47
14 14 14 8 9.96 8.10 8.84 7.04
6 6 6 8 7.24 6.13 6.08 5.25
4 4 4 19 4.26 3.10 5.39 12.50
12 12 12 8 10.84 9.13 8.15 5.56
7 7 7 8 4.82 7.26 6.42 7.91
5 5 5 8 5.68 4.74 5.73 6.89

Summary statistics

set cor sd_x sd_y mean_x mean_y intercept slope
1 0.816 3.317 2.032 9 7.501 3.000 0.5
2 0.816 3.317 2.032 9 7.501 3.001 0.5
3 0.816 3.317 2.030 9 7.500 3.002 0.5
4 0.817 3.317 2.031 9 7.501 3.002 0.5

… show hardly any differences between sets.

Anscombe’s Quartet

Same Stats, Different Graphs

Uncovering Simpson’s paradox

Advantages of visualisation

  • Ability to “see” large amounts of data
  • Reveals properties or structures in data that are not apparent in numerical summaries
  • Facilitates understanding of both large-scale and small-scale features of the data

A model of visual information processing

Visual encodings

Effectiveness of visual encoding

Effectiveness of visual encoding by data type

Affectiveness by color

User Interactions

Image from Spencer (2022, Feb. 17). Data in Wonderland. Retrieved from https://ssp3nc3r.github.io/data_in_wonderland

User Inputs

Image from Spencer (2022, Feb. 17). Data in Wonderland. Retrieved from https://ssp3nc3r.github.io/data_in_wonderland

Overview

Image from Spencer (2022, Feb. 17). Data in Wonderland. Retrieved from https://ssp3nc3r.github.io/data_in_wonderland

State of the art for
interactive plots

Interactive plots with JS

  • State-of-the-art for interactive plots is JS
  • Some of the most popular and free JS library for plotting are:
  • Rising JS libraries that are based on the Grammar of Graphics:

Interactive plots with JS through R

  • No need to learn JS!
  • Many JS library for plotting are available via an R package:
JS R package
Chart.js chartjs, charter
Dygraphs dygraphs
D3.js r2d3, networkD3
ECharts echarts4r
Google Charts googleVis
Highcharts highcharter
Plotly plotly
Vis.js visNetwork
Observable Plot obsplot
Vega and Vega-Lite vegawidget, altair, virgo, vegabrite

Plotly

Plotly

  • Plotly is a high-level, declarative library for plotting build on d3.js and stack.gl (open software ecosystem for WebGL).

Plotly for ggplot2

library(ggplot2)
g <- ggplot(ggplot2::diamonds, aes(x = cut, fill = clarity)) +
    geom_bar(position = "dodge") +
    scale_fill_brewer(palette = "Accent")

ggplotly(g)

Plotly with drop down menu

Code for Plotly with drop down menu

yields <- na.omit(cwdata::key_crop_yields)
crops <- sort(unique(yields$crop))

map(crops, ~ {
    yields %>%
        filter(crop == .x) %>%
        plot_ly(
            x = ~year,
            y = ~yield,
            type = "scatter",
            mode = "lines",
            color = ~crop,
            transforms = list(
                list(
                    type = "filter",
                    target = ~entity,
                    operation = "=",
                    value = "Afghanistan"
                )
            )
        )
}) %>%
    subplot(nrows = 3) %>%
    layout(
        showlegend = FALSE,
        annotations = imap(crops, ~ {
            list(
                x = 0 + 1 / 4 * (.y - 1) - 1 / 4 * 4 * (.y > 4) - 1 / 4 * 4 * (.y > 8),
                y = 1 - 0.05 - 1 / 3 * (.y > 4) - 1 / 3 * (.y > 8),
                font = list(size = 18),
                text = .x,
                xref = "paper",
                yref = "paper",
                xanchor = "center",
                yanchor = "bottom",
                showarrow = FALSE
            )
        }),
        updatemenus = list(list(
            type = "dropdown",
            active = 0,
            buttons = map(
                unique(yields$entity),
                ~ list(
                    method = "restyle",
                    args = list("transforms[0].value", .x),
                    label = .x
                )
            )
        ))
    )

Difference to Shiny

cwdata::run_app()

Code for Shiny app

library(shiny)
library(ggplot2)
library(dplyr)
library(cwdata)

ui <- fluidPage(
    br(),
    sidebarLayout(
        sidebarPanel(
            selectizeInput("entity",
                "Select a country or region:",
                choices = sort(unique(key_crop_yields$entity)),
                selected = "Australia"
            )
        ),
        mainPanel(
            plotOutput("tsplot")
        )
    )
)

server <- function(input, output, session) {
    output$tsplot <- renderPlot({
        key_crop_yields %>%
            filter(entity == input$entity) %>%
            ggplot(aes(year, yield)) +
            geom_line() +
            geom_point() +
            facet_wrap(~crop, scale = "free_y")
    })
}

shinyApp(ui, server)

Week 10 Lesson

Summary

  • Storytelling is a powerful technique to communicate data
  • Compose effective data stories requires you to
    • know your the goals (audience, message, desired effect),
    • selecting appropriate data, visualisations and aesthetic designs, and
    • receiving feedback.

Resources