Part III: Data Visualization
Seeing What the Numbers Cannot Say
There is a famous story in the history of data science, even if it was not called data science at the time. In 1973, the statistician Francis Anscombe constructed four datasets that have identical statistical summaries — the same mean, the same variance, the same correlation, the same regression line — but look completely different when you plot them. One is a clean linear relationship. Another is a perfect curve that a straight line misrepresents. A third is a line with a single extreme outlier dragging the statistics astray. The fourth is a vertical cluster of points with one far-flung observation creating the illusion of a trend that does not exist.
Anscombe's quartet makes a point that no data scientist should ever forget: numbers alone can deceive. Visualization reveals truth that summary statistics hide.
You have spent Parts I and II building powerful skills. You can write Python, manipulate DataFrames, clean messy data, reshape structures, and pull data from files and APIs. You have a clean, rich vaccination dataset ready for analysis. Now it is time to look at it. Not glance at it through the lens of means and medians — truly look at it, with charts and plots that make patterns visible, outliers obvious, and relationships tangible.
Part III will teach you to see data, and then to help others see it too.
Two Purposes, One Skill
Visualization serves two fundamentally different purposes, and understanding the distinction will make you better at both.
The first is exploratory visualization — charts you make for yourself, in the middle of analysis, to understand what is going on. These are quick, rough, and disposable. You are not trying to make them pretty. You are trying to make them revealing. A histogram of vaccination rates that shows a bimodal distribution. A scatter plot of GDP versus vaccination that reveals a cluster of outliers. A line chart of daily doses that exposes a suspicious gap in the data. Exploratory visualization is a thinking tool, an extension of your analytical mind.
The second is explanatory visualization — charts you make for an audience, to communicate a finding. These are polished, deliberate, and designed. Every label matters. Every color choice matters. The title tells the audience what to see. The annotation draws their eye to the key finding. Explanatory visualization is a communication tool, and doing it well requires understanding not just your data but your audience.
Part III teaches both, starting with the conceptual framework and building through three increasingly powerful libraries to a chapter on design principles and ethics that ties everything together.
What You Will Find in These Chapters
Chapter 14: The Grammar of Graphics begins not with code but with ideas. Before you write a single plotting command, you need a mental model for how charts work. The grammar of graphics decomposes every chart into components: data, aesthetic mappings (which variables map to position, color, size), geometric objects (points, lines, bars), and scales. This framework sounds abstract, but it is enormously practical. Once you understand it, you can look at any chart and decompose it into its components. You can look at any analytical question and compose a chart design to answer it. You will also learn to match question types to chart types — comparisons call for bars, relationships call for scatter plots, distributions call for histograms, change over time calls for lines — and you will practice by sketching chart designs on paper before touching a keyboard.
Chapter 15: matplotlib Foundations puts the grammar into practice with Python's foundational plotting library. matplotlib is powerful, flexible, and sometimes frustrating. Its API is verbose, and its documentation can be overwhelming. But understanding matplotlib is like understanding how a car engine works — even if you eventually drive something more automatic, the knowledge makes you a better driver. You will learn the Figure/Axes object-oriented interface, create line plots and bar charts and scatter plots and histograms, customize labels and titles and legends and colors, build multi-panel figures, and annotate charts with text and arrows that highlight your findings. Every chart uses your vaccination project data, so you will end this chapter with a real gallery of publication-quality figures.
Chapter 16: Statistical Visualization with seaborn lifts you to a higher level of abstraction. Where matplotlib gives you fine-grained control over every element, seaborn gives you statistically meaningful charts in a single function call. Distribution plots — histograms overlaid with density curves, box plots, violin plots — let you see the shape of your data. Relationship plots — scatter plots with color and size encoding, regression overlays — reveal connections between variables. Categorical comparisons — grouped bar plots, swarm plots — make group differences visible. Heatmaps and correlation matrices expose patterns in multivariate data that would be invisible in tables of numbers. seaborn's tight integration with pandas DataFrames means you can go from question to chart in one line of code.
Chapter 17: Interactive Visualization with plotly adds a dimension that static charts cannot provide: exploration by the viewer. Hover tooltips that reveal individual data points. Zoom and pan for different levels of detail. Click filtering to focus on specific categories. Animation to show change over time. And the crown jewel for geographic data: choropleth maps that paint the world in color, showing vaccination rates by country in a way that a table of numbers never could. You will build an interactive dashboard that a non-technical stakeholder could explore on their own, without writing any code. This chapter also asks an important question: when does interactivity add value, and when is it just decoration?
Chapter 18: Visualization Design steps back from specific tools to focus on principles that apply everywhere. You will learn perceptual science — which visual properties humans process pre-attentively (color, position, size) and which require conscious effort (angle, area). You will study accessibility — colorblind-safe palettes, sufficient contrast, alt text for screen readers. And you will confront the ethics of visualization — how truncated axes, cherry-picked time ranges, and misleading area encodings can make charts that are technically accurate but fundamentally dishonest. This chapter includes a gallery of bad charts that you will diagnose and redesign, building the critical eye that separates a thoughtful data scientist from someone who just makes pretty pictures.
The Progressive Project Comes Alive
This is where your vaccination project becomes visual. In Chapter 14, you will plan your charts on paper, deciding which visualization best answers each of your research questions. In Chapter 15, you will build bar charts comparing vaccination rates by region and line charts showing trends over time. In Chapter 16, you will add distribution plots, scatter plots of GDP versus vaccination rates, and correlation heatmaps that reveal multivariate structure. In Chapter 17, you will build an interactive choropleth map of global vaccination rates that someone could explore in a web browser. And in Chapter 18, you will go back to an earlier chart and redesign it for accessibility and clarity, producing a before-and-after comparison that demonstrates everything you have learned about design.
By the end of Part III, your project will have transformed from a collection of DataFrames and summary statistics into a visual narrative. You will not just know what the data says — you will be able to show what it says to anyone.
The Foundation for What Follows
Visualization is not just a reporting tool. It is an analytical tool that you will use constantly in Parts IV and V. When you study distributions in Chapter 21, you will visualize them. When you check regression assumptions in Chapter 26, you will do it with residual plots. When you compare model performance in Chapter 29, you will do it with ROC curves. The visualization skills you build here are not something you use once and set aside — they are woven into every subsequent chapter.
More profoundly, visualization teaches you to be skeptical. Once you have seen how a chart can mislead — once you have created a bad chart and then fixed it — you will never look at a data visualization the same way again. You will ask: what is the axis scale? What is the baseline? What is not being shown? That critical eye is one of the most valuable outcomes of this entire book.
An Invitation to Play
One more thing before you begin. Visualization is one of the most naturally enjoyable parts of data science. There is a genuine pleasure in seeing a messy dataset transform into a clear, elegant chart that reveals something you did not know before. If Parts I and II sometimes felt like hard work — and they were hard work, valuable hard work — Part III is where you get to enjoy the fruits. Make charts. Make lots of them. Make ugly ones and beautiful ones and surprising ones. Change the colors, try different chart types, zoom in on subsets, and see what happens.
The best visualizations are not the ones you plan in advance. They are the ones that make you say, "Huh, I did not expect that." Those moments of surprise are where discovery lives.
Let us start seeing.
Chapters in This Part
- Chapter 14: The Grammar of Graphics — Why Visualization Matters and How to Think About Charts
- Chapter 15: matplotlib Foundations — Building Charts from the Ground Up
- Chapter 16: Statistical Visualization with seaborn
- Chapter 17: Interactive Visualization — plotly, Dashboard Thinking
- Chapter 18: Visualization Design — Principles, Accessibility, Ethics, and Common Mistakes