Book Details

ISBN 139781784396695

Paperback302 pages

Book Description

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 will 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 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. Initially it uses simple plots and charts to more advanced ones, to make it easy to understand for readers. As the readers will go through the book, they will get to know about the 3D diagrams and animations. Maps are irreplaceable for displaying geo-spatial data, so this book will also show how to build them. In the last chapter, it includes explanation on how to incorporate matplotlib into different environments, such as a writing system, LaTeX, or how to create Gantt charts using Python.

Table of Contents

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 data files

Importing data from tab-delimited files

Importing data from a JSON resource

Exporting data to JSON, CSV, and Excel

Importing and manipulating data with Pandas

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 simple sine and cosine plots

Defining axis lengths and limits

Defining plot line styles, properties, and format strings

Setting ticks, labels, and grids

Adding legends and annotations

Moving spines to the center

Making histograms

Making bar charts with error bars

Making pie charts count

Plotting with filled areas

Making stacked plots

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

Customizing matplotlib with style

Chapter 5: Making 3D Visualizations

Introduction

Creating 3D bars

Creating 3D histograms

Animating in matplotlib

Animating with OpenGL

Chapter 6: Plotting Charts with Images and Maps

Introduction

Processing images with PIL

Plotting with images

Displaying images with other plots in the figure

Plotting data on a map using Basemap

Plotting data on a map using the Google Map API

Generating CAPTCHA images

Chapter 7: Using the Right Plots to Understand Data

Introduction

Understanding logarithmic plots

Understanding spectrograms

Creating 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-whisker plot

Making Gantt charts

Making error bars

Making use of text and font properties

Rendering text with LaTeX

Understanding the difference between pyplot and OO API

Chapter 9: Visualizations on the Clouds with Plot.ly

Introduction

Creating line charts

Creating bar charts

Plotting a 3D trefoil knot

Visualizing maps and bubbles

What You Will Learn

Introduce yourself to the essential tooling to set up your working environment

Authors

Igor Milovanović

Igor Milovanović is an experienced developer, with strong background in Linux system knowledge and software engineering education. He is skilled in building scalable data-driven distributed software rich systems.

An evangelist for high-quality systems design, he has a strong interest in software architecture and development methodologies. Igor is always committed to 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. With field experience and official training, he is capable of transferring knowledge and communication flow from business to developers and vice versa.

Igor is most grateful to his girlfriend for letting him spend hours on work instead with her and being an avid listener to his endless book monologues. He thanks his brother for being the strongest supporter. He is also thankful to his parents for letting him develop in various ways to become a person he is today.

Dimitry Foures

Dimitry is a data scientist with a background in applied mathematics and theoretical physics. After completing his physics undergraduate studies in ENS Lyon (France), he studied fluid mechanics at École Polytechnique in Paris where he obtained first Class class Master’s degree. He holds a PhD in applied mathematics from the University of Cambridge. He currently works as a data-scientist for a smart-energy start-up in Cambridge, in close collaboration with the university.

Giuseppe Vettigli

Giuseppe Vettigli is a data scientist who has worked in the research industry and academia for many years. His work is focused on the development of machine learning models and applications to use information from structured and unstructured data. He also writes about scientific computing and data visualisation in Python on his blog at http://glowingpython.blogspot.com.

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.