Python Data Visualization Cookbook

Python Data Visualization Cookbook
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Learn how to set up an optimal Python environment for data visualization
  • Understand the topics such as importing data for visualization and formatting data for visualization
  • Understand the underlying data and how to use the right visualizations

Book Details

Language : English
Paperback : 280 pages [ 235mm x 191mm ]
Release Date : November 2013
ISBN : 1782163360
ISBN 13 : 9781782163367
Author(s) : Igor Milovanović
Topics and Technologies : All Books, Enterprise Products and Platforms, Cookbooks, Open Source

Table of Contents

Chapter 1: Preparing Your Working Environment
Chapter 2: Knowing Your Data
Chapter 3: Drawing Your First Plots and Customizing Them
Chapter 4: More Plots and Customizations
Chapter 5: Making 3D Visualizations
Chapter 6: Plotting Charts with Images and Maps
Chapter 7: Using Right Plots to Understand Data
Chapter 8: More on matplotlib Gems
  • Chapter 1: Preparing Your Working Environment
    • Introduction
    • Installing matplotlib, NumPy, and SciPy
    • Installing virtualenv and virtualenvwrapper
    • Installing matplotlib on Mac OS X
    • Installing matplotlib on Windows
    • Installing Python Imaging Library (PIL) for image processing
    • Installing a requests module
    • Customizing matplotlib's parameters in code
    • Customizing matplotlib's parameters per project
  • Chapter 2: Knowing Your Data
    • Introduction
    • Importing data from CSV
    • Importing data from Microsoft Excel files
    • Importing data from fixed-width datafiles
    • Importing data from tab-delimited files
    • Importing data from a JSON resource
    • Exporting data to JSON, CSV, and Excel
    • Importing data from a database
    • Cleaning up data from outliers
    • Reading files in chunks
    • Reading streaming data sources
    • Importing image data into NumPy arrays
    • Generating controlled random datasets
    • Smoothing the noise in real-world data
  • Chapter 3: Drawing Your First Plots and Customizing Them
    • Introduction
    • Defining plot types – bar, line, and stacked charts
    • Drawing a simple sine and cosine plot
    • Defining axis lengths and limits
    • Defining plot line styles, properties, and format strings
    • Setting ticks, labels, and grids
    • Adding a legend and annotations
    • Moving spines to the center
    • Making histograms
    • Making bar charts with error bars
    • Making pie charts count
    • Plotting with filled areas
    • Drawing scatter plots with colored markers
  • Chapter 4: More Plots and Customizations
    • Introduction
    • Setting the transparency and size of axis labels
    • Adding a shadow to the chart line
    • Adding a data table to the figure
    • Using subplots
    • Customizing grids
    • Creating contour plots
    • Filling an under-plot area
    • Drawing polar plots
    • Visualizing the filesystem tree using a polar bar
  • Chapter 6: Plotting Charts with Images and Maps
    • Introduction
    • Processing images with PIL
    • Plotting with images
    • Displaying an image with other plots in the figure
    • Plotting data on a map using Basemap
    • Plotting data on a map using Google Map API
    • Generating CAPTCHA images
  • Chapter 7: Using Right Plots to Understand Data
    • Introduction
    • Understanding logarithmic plots
    • Understanding spectrograms
    • Creating a stem plot
    • Drawing streamlines of vector flow
    • Using colormaps
    • Using scatter plots and histograms
    • Plotting the cross-correlation between two variables
    • Importance of autocorrelation
  • Chapter 8: More on matplotlib Gems
    • Introduction
    • Drawing barbs
    • Making a box and a whisker plot
    • Making Gantt charts
    • Making errorbars
    • Making use of text and font properties
    • Rendering text with LaTeX
    • Understanding the difference between pyplot and OO API

Igor Milovanović

Igor Milovanović is an experienced developer with a strong background in Linux system and software engineering. He has skills in building scalable data-driven distributed software-rich systems. He is an Evangelist for high-quality systems design who holds strong interests in software architecture and development methodologies. He is always persistent on advocating methodologies that promote high-quality software, such as test-driven development, one-step builds, and continuous integration. He also possesses solid knowledge of product development. Having field experience and official training, he is capable of transferring knowledge and communication flow from business to developers and vice versa.
Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 2 submitted: last submission 03 Jun 2014

Page: 1,2 | Errata Type: Technical

Ubuntu 12.03 should be 12.04.3 

Page: 60 | Errata Type: Code


should be

plt.hist(res, buckets)

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Python Data Visualization Cookbook +    Bootstrap Site Blueprints =
50% Off
the second eBook
Price for both: £21.95

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Install and use iPython
  • Use Python's virtual environments
  • Install and customize NumPy and matplotlib
  • Draw common and advanced plots
  • Visualize data using maps
  • Create 3D animated data visualizations
  • Import data from various formats
  • Export data from various formats

In Detail

Today, data visualization is a hot topic as a direct result of the vast amount of data created every second. Transforming that data into information is a complex task for data visualization professionals, who, at the same time, try to understand the data and objectively transfer that understanding to others. This book is a set of practical recipes that strive to help the reader get a firm grasp of the area of data visualization using Python and its popular visualization and data libraries.

Python Data Visualization Cookbook will progress the reader from the point of installing and setting up a Python environment for data manipulation and visualization all the way to 3D animations using Python libraries. Readers will benefit from over 60 precise and reproducible recipes that guide the reader towards a better understanding of data concepts and the building blocks for subsequent and sometimes more advanced concepts.

Python Data Visualization Cookbook starts by showing you how to set up matplotlib and the related libraries that are required for most parts of the book, before moving on to discuss some of the lesser-used diagrams and charts such as Gantt Charts or Sankey diagrams. During the book, we go from simple plots and charts to more advanced ones, thoroughly explaining why we used them and how not to use them. As we go through the book, we will also discuss 3D diagrams. We will peep into animations just to show you what it takes to go into that area. Maps are irreplaceable for displaying geo-spatial data, so we also show you how to build them. In the last chapter, we show you how to incorporate matplotlib into different environments, such as a writing system, LaTeX, or how to create Gantt charts using Python.

This book will help those who already know how to program in Python to explore a new field – one of data visualization. As this book is all about recipes that explain how to do something, code samples are abundant, and they are followed by visual diagrams and charts to help you understand the logic and compare your own results with what is explained in the book.


This book is written in a Cookbook style targeted towards an advanced audience. It covers the advanced topics of data visualization in Python.

Who this book is for

Python Data Visualization Cookbook is for developers that already know about Python programming in general. If you have heard about data visualization but you don't know where to start, then this book will guide you from the start and help you understand data, data formats, data visualization, and how to use Python to visualize data.

You will need to know some general programming concepts, and any kind of programming experience will be helpful, but the code in this book is explained almost line by line. You don't need maths for this book, every concept that is introduced is thoroughly explained in plain English, and references are available for further interest in the topic.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software