Key Takeaways
Treat visualization as a pipeline from raw data to a useful question
The chart comes last. The book builds from Python fundamentals toward a working application: read files, create graphics, learn charting, retrieve web data, and finally connect the pieces. A visualization is therefore not just a call to a chart library. It depends on collecting information, converting it into usable values, choosing a visual form, and producing an output people can inspect.
Follow the data through. The capstone pulls publication dates from a blog's RSS feed, counts posts by month, and sends those counts to a bar chart. Each stage changes the data's form and purpose. Thinking in this sequence helps locate errors: a blank or misleading graphic may come from retrieval, parsing, aggregation, or rendering, not from the chart itself.
What's valuable here is the insistence that visual work starts before the plotting command. This aligns with data engineering practice, where lineage and validation matter as much as the final report. A useful chart makes a question answerable, but the pipeline also determines which questions can be asked. The book's RSS example is a compact demonstration, though a live feed is a narrow and changing sample. A production analysis would preserve the source data and document its limits, so a reader can distinguish a genuine pattern from a temporary feed snapshot.
Use SVG charts when resizing, browser display, and hover detail matter
Vectors travel well. The book's main library, pygal, creates charts as SVG, a vector graphic format that can be enlarged or reduced without the blur associated with fixed-size pixel images. A chart can be written to a file and opened in a browser, where built-in features such as hover labels reveal values and highlight a selected series.
Less setup, more range. The book presents pygal as approachable for beginners, with relatively few dependencies and chart types ranging from bars and lines to maps and gauges. It also introduces SVG generation with svgwrite before using a charting library, showing that SVG can hold selectable text and shapes as well as finished charts. The format is flexible for web pages and print, but complex maps can be demanding to render.
SVG makes the output adaptable: the same graphic can fit a phone-sized panel or a printed page without requiring separate image exports. That is a meaningful design advantage, especially when the chart contains labels that need to remain crisp. Hover interactions also add information without crowding the static image. Yet interaction is not automatically accessibility. A reader who cannot hover, or who views a static export, may miss those values. Good practice pairs interactive detail with clear labels or an accessible text equivalent, and tests complex graphics on the devices where they will appear.
Choose chart geometry for the comparison, not for visual novelty
Match form to relationship. The book uses line charts to show change over time, bars to compare categories, and XY charts to plot paired numeric values. Setting an XY chart's stroke to false turns it into a scatter plot, which can make many points easier to distinguish. DateY charts associate actual date objects with numeric values. The advanced examples include pie charts, radar charts, box plots, dot charts, funnels, gauges, pyramids, and maps.
The data sets the limits. A box plot summarizes a distribution; a radar chart compares several measures for an object. A pie chart implies parts of a whole, so its slices should represent compatible components. One sample set in the book totals more than 100 percent, a reminder to check the meaning and arithmetic before treating a chart's appearance as evidence.
The book's broad menu of chart types helps beginners see that plotting is a choice of visual grammar. Research on graphical perception finds that people judge some encodings, such as position along a common scale, more accurately than others, such as area or angle. That makes chart selection consequential, not cosmetic. The book's practical guidance about using scatter plots for dense point sets is a useful starting point, not a universal threshold. Before choosing a specialized form, the analyst should ask what comparison matters and whether viewers can read that comparison reliably.
Make labels, legends, and empty states part of the chart design
Clarity is configured. pygal lets the developer move a legend, resize legend symbols and text, rotate crowded axis labels, and set titles for the chart and its axes. Themes change the chart's visual style, while parameters such as `no data text` can display a message when a dynamic chart has no values. These choices become especially visible in the book's France map example, where many region names compete for space.
Design for the reader. A legend connects colors to datasets; axis titles explain what the values measure; rotated labels can prevent category names from colliding. A message for missing data is more informative than an empty frame. Styling is not a substitute for accurate data or a suitable chart, but thoughtful labeling can prevent a correct result from being misread.
These settings are small acts of interpretation. A legend's placement changes how easily a reader maps color to meaning, and a missing-data message distinguishes an unavailable feed from a true value of zero. This connects chart design to human-computer interaction: interfaces should reveal system state rather than leave users to guess. There is a useful limit, however. Shrinking text or truncating a legend can make a crowded chart fit while making it less understandable. When labels cannot be read at a sensible size, simplifying the categories may be better than squeezing the layout.
Fetch web data defensively, then parse its structure before charting
A response is not yet data. The book uses Python's `urllib2` to request web content, then parses RSS or other XML with ElementTree and selects nodes using XPath-style paths. For JSON, Python's `json` library turns the response string into dictionaries and lists that can be navigated by keys. RSS and ATOM are XML-based feed formats, but their element names and structures differ.
Expect imperfect connections. The examples wrap requests in error handling and close the response when finished. JSONP adds a callback wrapper around JSON, which prevents a plain JSON parser from reading it until the wrapper is removed. A successful download is only the start: the program must still identify the right fields and handle connection or parsing failures without silently producing a misleading chart.
Separating retrieval from parsing is a durable lesson because network data has two kinds of uncertainty: the connection can fail, and the remote structure can change. Treating an API response as a contract makes failures easier to diagnose than treating it as an unstructured string. The book's examples introduce useful safeguards, but contemporary applications also need explicit timeouts, careful error messages, and validation of required fields. A catch-all handler can keep a script running while concealing the specific failure, so resilient software should preserve enough diagnostic detail to support repair.
Convert timestamps into usable categories before counting or plotting
Strings need interpretation. In the blog example, publication dates arrive as text in RSS. The program removes commas, splits the text into pieces, and uses `strptime` to convert it into a structured time value. It can then extract the month and count how often each month appears. At the time of the example, the feed contains 43 posts in May and 7 in June.
Keep the time context. A chart cannot count meaningfully until dates are represented in a form the program understands. The book first stores month numbers in a list and counts occurrences, then shows a more flexible direction using a dictionary of month totals. Since the feed only covers a recent window, its counts describe that window, not a complete historical record.
Date parsing illustrates a broader analytical principle: categories are constructed, not simply found in raw text. The conversion makes aggregation possible, but dropping the year can combine the same month across different years, and ignoring time zones can shift events near midnight. For a short, recent feed, a month count may be adequate; for longer histories, year and month should travel together. The example's counts are also a snapshot of a changing website. Any conclusion drawn from them should name the period and acknowledge the feed's limited coverage.
Separate fetching, transforming, and rendering so each piece can change
Give each module a job. The working project separates RSS retrieval and date counting into `LoadRssFeed`, chart construction into `chart build`, and program startup into a main script. The data module returns values instead of printing them, allowing another module to use the result. The chart module accepts data as an input and applies a reusable configuration for dimensions, labels, titles, and missing-data text.
Reuse without entangling. The book also shows a more general chart input made of label-and-value pairs, so categories need not be fixed to May and June. This structure makes it easier to change the feed, chart appearance, or output behavior independently. Modular code is not just tidier: it makes the boundary between each operation visible and gives each part a clearer responsibility.
The separation resembles the single-responsibility principle in software design: a component is easier to test when it has one clear reason to change. It also creates natural test points. A date-counting function can be checked with saved sample data, while chart rendering can be tested without an active internet connection. The book's architecture is a useful first step, though modules alone do not guarantee independence. Hard-coded URLs, month numbers, and network access inside a function still couple behavior. Explicit inputs and predictable outputs matter more than the number of files.
Pick libraries by output and workflow, not popularity alone
Different tools solve different jobs. The book favors pygal for an introductory path to SVG charts. It presents matplotlib as a broader plotting library, including static graphics and interactive 3D views, and Plotly as a service for creating and sharing interactive charts online. Plotly's examples require Python 3 and account credentials, unlike the book's primary Python 2.7 workflow. Pyvot appears as a route for moving Python data into Excel, with alternatives mentioned because it was no longer maintained at publication.
Start with the delivery context. A browser-ready SVG, a scientific plot, a hosted shareable graphic, and an Excel workflow are different needs. A library should be selected for the output, interaction, dependencies, and environment a project actually requires, rather than for a list of features alone.
Tool choice is partly a question of deployment and control. A hosted charting service can make sharing easy, while a local plotting library may better suit offline work or sensitive data. A simple library can shorten the path from idea to result, but it may not offer the customization or analytical ecosystem a project eventually needs. The book's comparisons are useful as a map of trade-offs, not a timeless ranking. Its tools and services have changed since publication, so present-day developers should verify maintenance, licensing, and compatibility before adopting any specific package.
Plan dependencies and runtime compatibility before choosing a chart library
Installation is part of development. The book walks through Python setup on Windows, Mac OS X, and Ubuntu, and compares tools such as `pip`, `easy install`, and the Ubuntu package manager. It highlights `lxml`, a dependency that can be difficult to install on Windows because it includes C-based components. An IDE can help identify installed packages, while a project-specific environment can reduce reliance on libraries installed elsewhere on the machine.
Treat the instructions as historical. This 2014 guide targets Python 2.7 for most examples and Python 3.4 or higher for Plotly. Those version requirements are part of the original context, not current setup advice. The enduring lesson is to check language versions, operating-system support, and native dependencies before committing to a library.
The installation chapters expose an often-hidden cost of technical tutorials: code depends on a particular ecosystem, not only on its written logic. Reproducible environments reduce the familiar problem of a project working on one machine but failing on another. The book's period-specific instructions now require substantial caution, especially because Python 2 is obsolete. That does not erase the conceptual value of the examples; it changes how they should be used. Readers can retain the workflow of checking dependencies and isolating projects while translating the commands to a supported runtime.
Analysis
This is a practical programming guide organized as a gradual build, not a theory of visual perception. Its narrative moves from installing Python and learning basic input and output to generating graphics, using pygal, retrieving web data, and assembling a small application. The book's strongest teaching choice is that it does not treat charts as isolated snippets. The reader first sees that files and network responses must be opened, interpreted, transformed, and only then rendered. The RSS chart makes this sequence concrete and approachable.
Its scope is deliberately broad at the level of chart types. Lines, bars, scatter plots, box plots, maps, and gauges are presented as available tools, with basic guidance about what each can show. That breadth invites experimentation, but the book gives less attention to the deeper problem of selecting an encoding that viewers can compare accurately. Its examples are tutorials in API use, not evidence that each chart type is appropriate for the particular data shown. The tablet pie chart, whose values exceed a whole, makes the need for semantic validation especially clear.
The most durable ideas are therefore architectural: keep data acquisition distinct from parsing, convert values before aggregating, configure charts for readability, and match the library to the output environment. The book's modular RSS project demonstrates these principles at beginner scale, though hard-coded months and a limited feed make it a teaching example rather than a robust analytics system.
The historical context matters. Python 2.7, installation procedures, and library versions date the instructions, and some advice cannot be followed literally today. A modern reader should treat the code as a record of concepts, not a current dependency recipe. The lasting value is the mental model: a visualization is a reproducible data process with a visual endpoint, and every stage can introduce error or clarity.
Review Summary
Learning Python Data Visualization receives mixed reviews. Some readers find it useful for learning PyGal and visualizing data from various sources, particularly in chapters 6 and 7. However, others criticize the extensive coverage of basic Python installation and fundamentals, which they consider unnecessary. One reviewer praises the book's accessibility for non-Python programmers and its potential for advanced users to extend the examples. Conversely, another reader harshly criticizes the book's content quality and organization, deeming it a waste of time.
Glossary
pygal
Python SVG chart libraryA Python library presented in the book for creating charts as SVG graphics. It includes common forms such as lines, bars, and pie charts, along with options such as maps, gauges, and box plots. Its rendered charts can be displayed in browsers and include features such as hover details.
DateY
Date-based XY chartA pygal chart type for plotting numeric values against Python date or datetime objects. The date provides the horizontal position and the supplied number provides the vertical value. The book uses it to show passenger counts at dates and times, and demonstrates rotating crowded date labels.
JSONP
JSON wrapped in a callbackA format in which JSON data is enclosed in a function call, historically used to work around browser cross-origin restrictions. Because the wrapper means the response is not plain JSON, a standard JSON parser cannot load it unchanged. The book describes removing the callback text before parsing the remaining JSON.
ConfigChart
Reusable pygal settings classA custom class in the book's project that inherits from pygal's configuration object and groups chart settings in one place. It sets options such as chart size, titles, labels, tooltips, and text for empty data. Passing the configuration to a chart makes those choices reusable and easier to update.
Download PDF
Download EPUB
.epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.