Book Image

Learning IPython for Interactive Computing and Data Visualization, Second Edition

By : Cyrille Rossant
Book Image

Learning IPython for Interactive Computing and Data Visualization, Second Edition

By: Cyrille Rossant

Overview of this book

Python is a user-friendly and powerful programming language. IPython offers a convenient interface to the language and its analysis libraries, while the Jupyter Notebook is a rich environment well-adapted to data science and visualization. Together, these open source tools are widely used by beginners and experts around the world, and in a huge variety of fields and endeavors. This book is a beginner-friendly guide to the Python data analysis platform. After an introduction to the Python language, IPython, and the Jupyter Notebook, you will learn how to analyze and visualize data on real-world examples, how to create graphical user interfaces for image processing in the Notebook, and how to perform fast numerical computations for scientific simulations with NumPy, Numba, Cython, and ipyparallel. By the end of this book, you will be able to perform in-depth analyses of all sorts of data.
Table of Contents (13 chapters)
Learning IPython for Interactive Computing and Data Visualization Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

matplotlib and seaborn essentials


matplotlib is the main plotting library in Python. While it is particularly rich and powerful, it may be difficult to use sometimes. Further, its default styling could be better. There is some work in progress to improve the default styling in matplotlib. In the meantime, the seaborn library offers better styling for matplotlib as well as easy-to-use high-level statistical plotting routines based on matplotlib.

In this section, we will detail some of the main plotting capabilities of matplotlib, while using the seaborn styling.

We first import matplotlib and seaborn and we activate the inline mode in the Notebook:

In [1]: import numpy as np
        import matplotlib.pyplot as plt
        import seaborn
        %matplotlib inline

Note

There is a pylab mode that imports all NumPy and matplotlib variables into the interactive namespace. This mode makes the transition easier for users coming from MATLAB. However, using this mode is not recommended. The standard...