Learning Python Data Visualization: Master how to build dynamic HTML5-ready SVG charts
using Python and the pygal library
Download
Introduction
Greetings, this is Chad Adams, and welcome to Learning Python Data Visualization.
In this book, we will cover the basics of generating dynamic charts and general
graphics with code using the Python programming language. We will use the pygal
library, a simple yet powerful graphing library written for Python, to explore the
different types of charts we can create for various kinds of data.
We will also review the Python language itself and discuss working with file
I/O and cover topics on working with data. We will then parse that data into a
chart to create a dynamic charting application. We will also touch on more popular
(and more advanced) libraries such as matplotlib and Plotly and build charts using
these libraries and explore their features.
With this book, we will explore and build data visualizations using the basic toolsets
used in many popular charting applications for the scientific, financial, medical, and
pharmaceutical industries.
What this book covers
Chapter 1, Setting Up Your Development Environment, will discuss the installation
process for Python on Windows, Mac, and Ubuntu. We will review the easy_install
and pip package managers for Python and discuss common issues when installing
third-party libraries for Python.
Chapter 2, Python Refresher, will quickly review the Python language and common
libraries found in most Python developers' tool belts. We will also ease into building
charts by creating custom graphics with nothing but code and learn about saving
files to the filesystem.
Chapter 3, Getting Started with pygal, will cover the basics of the pygal library, a simple
charting library that generates charts in HTML5-ready SVG files. We will build some
basic charts using the library, some of which include line charts, bar charts, and
scatter plots.
Chapter 4, Advanced Charts, will cover more complex charts in the pygal library such
as box plots, radar charts, and worldmap charts.
Chapter 5, Tweaking pygal, will discuss the optional settings we can give our pygal
charts such as adjusting the font size and the positioning of labels and legends.
We will also cover the French country map chart in the pygal library using it as
an example.
Chapter 6, Importing Dynamic Data, will go over the finer points of pulling data from
the Web using the Python language and its built-in libraries and cover parsing XML,
JSON, and JSONP data.
Chapter 7, Putting It All Together, will build a simple chart that takes what we learned
from the past chapters and builds a dynamic pygal-based chart using data from
the Web.
Chapter 8, Further Resources, will review some very popular charting libraries such
as matplotlib and Plotly, go over building sample charts for each library, and cover
resources for further reading.
Appendix, References and Resources, will list some popular data visualization libraries
for Python as well as some helpful utilities.
What you need for this book
You will need Windows, Mac, or an Ubuntu system that is running Python 2.7
32-bit or Python 2.7 64-bit. You will need to have administrator rights on this
system. You will also need a Python text editor such as Eclipse or Visual Studio
with Python Tools. For Chapter 8, Further Resources, you will also need Python 3.4
or higher. Python 2.7 and 3.4 can be installed alongside each other.
Who this book is for
If you're new to the Python language and are looking at getting into building charts
using Python, this is a great resource to get started. If you have done a bit of Python
development already but have not ventured into graphics and charts, there is plenty
of information in this book with regards to creating these.