THINK FIRST·CODE LATER

← Interactive Information Visualization
Chapter 1 · Week 1

Visualization in the Age of AI

Before You Start: What You Must Be Able to Do

Before the questions, make sure you can: define visualization in Munzner's terms and say when it is (and is not) the right tool; explain with Anscombe's quartet why summary statistics are not enough; describe the visualization pipeline from raw data to an interactive view; state Shneiderman's mantra; recognize the main Python visualization libraries and where BI tools fit; read a simple chart specification (mark, encodings, data types); and explain what AI assistants do well, where they fail, and how you will verify what they produce.

The Big Idea

A chatbot can draw a chart in five seconds. It cannot tell you whether that chart answers the right question, whether it hides the one pattern that matters, or whether it will mislead the person who makes a decision with it. This course is about those judgments — and about the engineering needed to turn data from files, databases and the web into interactive tools people actually use. You will use AI throughout, but as a fast, fallible assistant whose work you check, never as the author of record.

What visualization is

Tamara Munzner's definition, which we use all semester:

Computer-based visualization systems provide visual representations of datasets designed to help people carry out tasks more effectively.

Three words carry the weight:

  • people — a human is in the loop. If a fully automatic answer is trustworthy (a sort, a threshold alarm), you may not need a visualization at all.
  • tasks — a visualization is good or bad for a task: finding outliers, comparing groups, following a trend. The same chart can be excellent for one task and useless for another (Chapter 3).
  • more effectively — a visualization competes with a table, a number, a sentence. It has to win.

Visualization works because the human visual system processes position, length, colour and shape in parallel and pre-attentively: a red dot among blue ones "pops out" in a fraction of a second, whereas finding the largest number in a column of 1,000 values requires reading them one by one. A chart offloads memory and comparison work from the mind to the eye — this is called external cognition.

Why statistics are not enough: Anscombe's quartet

In 1973 the statistician Francis Anscombe published four small datasets (11 points each). Their summaries are, to two decimals, identical:

Dataset mean x mean y var x var y correlation r regression line
I 9.00 7.50 11.00 4.13 0.816 y = 3.00 + 0.500x
II 9.00 7.50 11.00 4.13 0.816 y = 3.00 + 0.500x
III 9.00 7.50 11.00 4.12 0.816 y = 3.00 + 0.500x
IV 9.00 7.50 11.00 4.12 0.817 y = 3.00 + 0.500x

Plotted, they could not be more different: I is a noisy linear trend, II a smooth curve, III a perfect line with one outlier, and IV a vertical stack of points plus one far-away point that alone creates the "correlation". The Datasaurus Dozen (Matejka & Fitzmaurice, CHI 2017) pushed the idea further: thirteen datasets with the same means, standard deviations and correlation — one of which is a drawing of a dinosaur. Always look at your data.

The visualization pipeline

The reference model of Card, Mackinlay and Shneiderman (1999) describes every visualization tool:

  1. Raw data — files, databases, APIs, web pages, sensors (Chapters 2–3).
  2. Data transformation — cleaning, filtering, aggregating, joining into data tables.
  3. Visual mapping — choosing marks (points, lines, bars, areas) and channels (position, length, colour, size) for the attributes (Chapters 5–7).
  4. View transformation — layout, zoom, pan, multiple views.
  5. Interaction — the user changes any of the previous steps: filters data, selects items, switches encodings (Chapter 8).

Ben Shneiderman's visual information-seeking mantra (1996) summarizes good interactive design: overview first, zoom and filter, then details on demand.

A short history

Visualization is older than computers. William Playfair invented the line, bar and pie charts (1786–1801). John Snow's 1854 map of cholera deaths in London pointed to the Broad Street water pump. Florence Nightingale's 1858 polar-area diagrams convinced the British government that sanitation, not battle, killed most soldiers in Crimea. Charles Joseph Minard's 1869 map of Napoleon's Russian campaign shows six variables — army size, position, direction, temperature, dates, places — in one image. Each of them used a picture to change a decision, which remains the goal.

Tools: code, grammar and BI

Family Examples Strengths Limits
Low-level plotting matplotlib, seaborn total control, publication figures interaction is limited, verbose
Grammar of graphics Altair (on Vega-Lite), ggplot2, plotnine declarative: you say what to encode, not how to draw; interaction built in very large data needs aggregation first
Interactive web plotting Plotly, Bokeh rich interaction, dashboards, streaming more code for complex linking
Apps and dashboards Streamlit, Dash, Panel, Bokeh server turn analyses into web apps deployment and state to manage
JavaScript D3.js, Vega, Observable unlimited custom designs steep learning curve
BI software Tableau, Power BI, Apache Superset, Grafana fast for business users, governance less flexible, licence costs

We use Altair as the main library because a chart is a specification — a small JSON document in the Vega-Lite grammar (Satyanarayan et al., 2017) — that you can read, check and version. That property matters in the age of AI: language models generate Vega-Lite and Altair code well, and a specification can be audited by a program (Lab V1.3).

A chart specification in Altair:

alt.Chart(df).mark_line().encode(
    x="date:T",              # T = temporal
    y="mean(pm25):Q",        # Q = quantitative, aggregated with mean
    color="district:N",      # N = nominal (categories)
)

The suffixes :Q, :N, :O and :T declare the attribute types (Chapter 2); when you pass a pandas DataFrame and omit them, Altair infers them from the column dtypes.

What AI can and cannot do

Large language models (and tools built on them such as Microsoft's LIDA, or the analysis modes of chat assistants) can now: suggest charts for a dataset, write pandas/Altair/Plotly code, generate Vega-Lite specifications from a sentence ("show monthly trips by station"), describe a chart in words, and even answer questions about a chart image.

They also fail in characteristic ways:

  • Plausible but wrong code — a deprecated API, a wrong column name, a silent type error (dates treated as text, sorted alphabetically).
  • Wrong aggregation — summing an average, counting rows instead of distinct users.
  • Misleading defaults — a truncated axis on a bar chart, a rainbow colour map, a pie chart with 12 slices.
  • Answering a different question — a beautiful chart of what was easy to plot, not of what the user needed.
  • Invented facts — a "description" of a trend that is not in the data.

Our rule for the semester: AI may draft; you decide and you verify. Every AI-assisted artefact must be checked against the data (re-compute key numbers), against the task (does it answer the question?) and against design principles (Chapters 5–6). Where AI is used, you say how.

Industry spotlight

Analysts in companies spend most of their time not on drawing charts but on getting, cleaning and joining data, and on deciding what to show to whom. BI teams increasingly use AI copilots (in Power BI, Tableau, Looker) to draft reports — and still need people who can tell whether the draft is right.

Research spotlight

Natural-language interfaces to visualization (NL2VIS), automatic chart recommendation, chart question answering and AI-generated chart descriptions for accessibility are active research areas at IEEE VIS and ACM CHI. A recurring finding: models do well on simple, clean cases and degrade on ambiguous questions, messy data and charts that require domain knowledge — exactly where human judgment remains essential (Chapter 12).

The case study: CityPulse

All semester we work on CityPulse, an open-data platform for a mid-size city ("Oujiang City"). It collects air-quality readings (PM2.5, temperature) from sensors in each district, bike-share trips between stations, energy use of public buildings, and bus arrival times. Its users are very different: city officials (Is air quality improving?), citizens (Is it safe to run today?), operators (Which bike stations are empty?) and researchers. Each chapter adds a piece: data acquisition, task analysis, encodings, interaction, dashboards, maps, scaling, AI features and evaluation.

Key takeaways

  • Visualization = visual representations of data that help people perform tasks more effectively; a human is in the loop.
  • Summary statistics can be identical for very different data (Anscombe, Datasaurus) — always plot.
  • Pipeline: raw data → transformation → visual mapping → view, with interaction at every step. Mantra: overview, zoom and filter, details on demand.
  • Altair/Vega-Lite turns a chart into a readable specification (mark + encodings + types Q N O T).
  • AI drafts quickly but fails with wrong code, wrong aggregations, misleading defaults and invented descriptions — verify against data, task and design principles.

Ready? Close the notes and practise.

30 questions. Predict the output before you check — that is the skill the exam measures.