Follow ______ on twitter.

2.5.2 Effective Data Presentation Techniques

Code

Vega-Lite Chart

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "config": {
    "view": {
      "continuousWidth": 300,
      "continuousHeight": 300
    }
  },
  "hconcat": [
    {
      "hconcat": [
        {
          "title": [
            "Annual Number of Extreme",
            "Weather Events (1980-2024) - Histogram"
          ],
          "width": 220,
          "height": 220,
          "data": {
            "sequence": {
              "start": 1,
              "stop": 100,
              "step": 1,
              "as": "EventCount"
            }
          },
          "transform": [
            {
              "calculate": "samplePoisson(20)",
              "as": "NumberOfEvents"
            },
            {
              "bin": {
                "maxbins": 10
              },
              "field": "NumberOfEvents",
              "as": "binnedNumberOfEvents"
            },
            {
              "aggregate": [
                {
                  "op": "count",
                  "as": "Frequency"
                }
              ],
              "groupby": [
                "binnedNumberOfEvents"
              ]
            }
          ],
          "mark": {
            "type": "bar",
            "size": 30
          },
          "encoding": {
            "x": {
              "field": "binnedNumberOfEvents",
              "type": "quantitative",
              "axis": {
                "title": "Number of Events"
              }
            },
            "y": {
              "field": "Frequency",
              "type": "quantitative",
              "axis": {
                "title": "Frequency"
              }
            },
            "color": {
              "field": "binnedNumberOfEvents",
              "type": "quantitative",
              "legend": null
            }
          }
        },
        {
          "title": [
            "Trend of Extreme Weather",
            "Events (1980-2024) - Line Chart"
          ],
          "width": 220,
          "height": 220,
          "data": {
            "sequence": {
              "start": 1980,
              "stop": 2025,
              "step": 1,
              "as": "Year"
            }
          },
          "transform": [
            {
              "calculate": "samplePoisson(20)",
              "as": "NumberOfEvents"
            }
          ],
          "mark": "line",
          "encoding": {
            "x": {
              "field": "Year",
              "type": "temporal",
              "title": "Year"
            },
            "y": {
              "field": "NumberOfEvents",
              "type": "quantitative",
              "title": "Number of Events"
            }
          }
        }
      ]
    },
    {
      "hconcat": [
        {
          "title": [
            "Proportion of Extreme Weather",
            "Events (1980-2024) - Pie Chart"
          ],
          "width": 220,
          "height": 220,
          "data": {
            "values": [
              {
                "category": "Fires",
                "count": 12
              },
              {
                "category": "Hurricanes",
                "count": 15
              },
              {
                "category": "Floods",
                "count": 23
              }
            ]
          },
          "mark": "arc",
          "encoding": {
            "theta": {
              "field": "count",
              "type": "quantitative",
              "title": "Count"
            },
            "color": {
              "field": "category",
              "type": "nominal",
              "title": "Event Type"
            }
          }
        },
        {
          "title": [
            "Correlation Between Number of Events",
            "and CO2 Emissions - Scatter Plot"
          ],
          "width": 220,
          "height": 220,
          "data": {
            "values": [
              {
                "Year": 1980,
                "NumberOfEvents": 10,
                "CO2Emissions": 300
              },
              {
                "Year": 1985,
                "NumberOfEvents": 12,
                "CO2Emissions": 320
              },
              {
                "Year": 1990,
                "NumberOfEvents": 14,
                "CO2Emissions": 340
              },
              {
                "Year": 1995,
                "NumberOfEvents": 16,
                "CO2Emissions": 360
              },
              {
                "Year": 2000,
                "NumberOfEvents": 18,
                "CO2Emissions": 380
              },
              {
                "Year": 2005,
                "NumberOfEvents": 20,
                "CO2Emissions": 400
              },
              {
                "Year": 2010,
                "NumberOfEvents": 22,
                "CO2Emissions": 420
              },
              {
                "Year": 2015,
                "NumberOfEvents": 24,
                "CO2Emissions": 440
              },
              {
                "Year": 2020,
                "NumberOfEvents": 26,
                "CO2Emissions": 460
              }
            ]
          },
          "mark": "point",
          "encoding": {
            "x": {
              "field": "CO2Emissions",
              "type": "quantitative",
              "title": "CO2 Emissions (Mt)"
            },
            "y": {
              "field": "NumberOfEvents",
              "type": "quantitative",
              "title": "Number of Events"
            },
            "color": {
              "field": "Year",
              "type": "quantitative",
              "title": "Year"
            }
          }
        }
      ]
    }
  ]
}