Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering Matplotlib
Mastering Matplotlib

Mastering Matplotlib: A practical guide that takes you beyond the basics of matplotlib and gives solutions to plot complex data

Arrow left icon
Profile Icon Duncan M McGreggor Profile Icon Duncan M. McGreggor
Arrow right icon
£32.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.5 (8 Ratings)
Paperback Jun 2015 292 pages 1st Edition
eBook
£17.99 £26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m
Arrow left icon
Profile Icon Duncan M McGreggor Profile Icon Duncan M. McGreggor
Arrow right icon
£32.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.5 (8 Ratings)
Paperback Jun 2015 292 pages 1st Edition
eBook
£17.99 £26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m
eBook
£17.99 £26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Mastering Matplotlib

Chapter 1. Getting Up to Speed

Over the past 12 years of its existence, matplotlib has made its way into the classrooms, labs, and hearts of the scientific computing world. With Python's rise in popularity for serious professional and academic work, matplotlib has taken a respected seat beside long-standing giants such as Mathematica by Wolfram Research and MathWorks' MATLAB products. As such, we feel that the time is ripe for an advanced text on matplotlib that guides its more sophisticated users into new territory by not only allowing them to become experts in their own right, but also providing a clear path that will help them apply their new knowledge in a number of environments.

As a part of a master class series by Packt Publishing, this book focuses almost entirely on a select few of the most requested advanced topics in the world of matplotlib, which includes everything from matplotlib internals to high-performance computing environments. In order to best support this, we want to make sure that our readers have a chance to prepare for the material of this book, so we will start off gently.

The topics covered in this chapter include the following:

  • A brief historical overview of matplotlib
  • What's new in matplotlib
  • Who is an advanced, beginner, or an intermediate matplotlib user
  • The software dependencies for many of the book's examples
  • An overview of Python 3
  • An overview of the coding style used in this book
  • References for installation-related instructions
  • A refresher on IPython Notebooks
  • A teaser of a complicated plot in matplotlib
  • Additional resources to obtain advanced beginner and intermediate matplotlib knowledge

A brief historical overview of matplotlib

The open source project that we now know as matplotlib had its inception at the beginning of the millennium when John Hunter and his colleagues were conducting epilepsy research using proprietary data analysis software. They migrated to MATLAB as it was more flexible and less expensive. However, it was not designed to handle the data formats and diverse data sources that they had to contend with on a daily basis.

It was with this realization that John Hunter created the first version of matplotlib—a GTK+ visualization tool for electroencephalography and electrocorticography analysis. Having been built in Python, adding support for new features as the team needed them was a straightforward task. Before long, this led to the idea of providing a similar interactive command mode to generate plots on the fly, as MATLAB does.

One of the oldest sources available for matplotlib code online is the GitHub repository. The first commit in this repository was with regard to migration from Subversion to Git, though the original repository was CVS. This commit was authored in May 2003, though this repository records a CHANGELOG file whose first entry was made in December 2002. By the time this book goes into publication, matplotlib will have celebrated its 13th birthday.

What's new in matplotlib 1.4

In the past 12 years, a great deal has happened in the matplotlib codebase. Of particular interest are the new features that have been added to the most recent release at the time of writing this book—version 1.4.3. Here are some of its highlights:

  • A new IPython Notebook backend for interactive matplotlib plot support
  • A new style package that allows for greater control over the visual presentation of plots
  • The new Qt5 backend
  • Google App Engine integration
  • New plotting features
  • New configuration options

The intermediate matplotlib user

If you've read the preface, then you know who this book is for—developers with intermediate or advanced knowledge of matplotlib as well as the motivated beginners. But who are they exactly? What do such users know?

Answers to such questions are fairly open-ended. We have the following guidelines. The intermediate matplotlib user should have some limited knowledge to passing experience with the following:

  • Installation of matplotlib in multiple environments
  • Creation of basic to moderately complicated matplotlib plots
  • Basic matplotlib APIs, styling, backends, and customizations
  • Using matplotlib objects, subplots, and overlays
  • Advanced third-party tools such as Seaborn, Pandas, ggplot, distributed IPython, and StarCluster
  • Completed reading most or all of the following books, Matplotlib for Python Developers, Sandro Tosi, Packt Publishing, and matplotlib Plotting Cookbook, Alexandre Devert, Packt Publishing

Prerequisites for this book

This book assumes that you have previous experience with matplotlib and that it has been installed on your preferred development platform. If you need a refresher on the steps to accomplish that, the first chapter of Sandro Tosi's excellent book, Matplotlib for Python Developers, provides instructions to install matplotlib and its dependencies.

In addition to matplotlib, you will need a recent installation of IPython to run many of the examples and exercises provided. For help in getting started with IPython, there many great resources available on the project's site. Cyrille Rossant has authored Learning IPython for Interactive Computing and Data Visualization, Packt Publishing, which is a great resource as well.

In the course of this book, we will install, configure, and use additional open source libraries and frameworks. We will cover the setup of these as we get to them, but all the programs in this book will require you to have the following installed on your machine:

  • Git
  • GNU make
  • GNU Compiler Collection (gcc)

Your operating system's package manager should have a package that installs common developer tools—these tools should be installed as well, and may provide most of the tools automatically.

All the examples in this book will be implemented using a recent release of Python, version 3.4.2. Many of the examples will not work with the older versions of Python, so please note this carefully. In particular, the setup of virtual environments uses a feature that is new in Python 3.4.2, and some examples use the new type annotations. At the time of writing this book, the latest version of Ubuntu ships with Python 3.4.2.

Though matplotlib, NumPy, IPython, and the other libraries will be installed for you by set scripts provided in the code repositories for each chapter. For the sake of clarity, we will mention the versions used for some of these here:

  • matplotlib 1.4.3
  • NumPy 1.9.2
  • SciPy 0.15.1
  • IPython 3.1.0 (also known as Jupyter)

Python 3

On this note, it's probably good to discuss Python 3 briefly as there has been continued debate on the choice between the two most recent versions of the programming language (the other being the 2.7.x series). Python 3 represents a massive community-wide effort to adopt better coding practices as well as improvements in the maintenance of long-lived libraries, frameworks, and applications. The primary impetus and on-going strength of this effort, though, is a general overhaul of the mechanisms underlying Python itself. This will ultimately allow the Python programming language greater maintainability and longevity in the coming years, not to mention better support for the ongoing performance enhancements.

In case you are new to Python 3, the following table, which compares some of the major syntactical differences between Python 2 and Python 3, has been provided:

Syntactical Differences

Python 2

Python 3

Division with floats

x = 15 / 3.0

x = 15 / 3

Division with truncation

x = 15 / 4

x = 15 // 4

Longs

y = long(x * 10)

y = int(x * 10)

Not equal

x <> y

x != y

The unicode function

u = unicode(s)

u = str(s)

Raw unicode

u = ur"\t\s"

u = r"\t\s"

Printing

print x, y, z

print(x, y, z)

Raw user input

y = raw_input(x)

y = input(x)

User input

y = input(x)

y = eval(input(x))

Formatting

"%d %s" % (n, s)

"{} {}".format(n,s)

Representation

'x'

repr(x)

Function application

apply(fn, args)

fn(*args)

Filter

itertools.ifilter

filter

Map

itertools.imap

map

Zip

itertools.izip

zip

Range

xrange

range

Reduce

reduce

functools.reduce

Iteration

iterator.next()

next(iterator)

The execute code

exec code

exec(code)

The execute file

execfile(file)

exec(fh.read())

Exceptions

try:

...

except val, err:

...

try:

...

except val as err:

...

Coding style

The coding style used throughout this book and in the example code conforms to the standards laid out in PEP 8, with one exception. When entering code into an IPython Notebook or providing modules that will be displayed in the notebook, we will not use two lines to separate what would be module-level blocks of code. We will just use one line. This is done to save screen space.

Something that might strike you as different in our code is the use of an extraordinary feature of Python 3—function annotations. The work for this was done in PEP 3107 and was added in the first release of Python 3. The use of types and static analysis in programming, though new to Python, is a boon to the world of software. It saves time in development of a program by catching bugs before they even arise as well as streamlining unit tests. The benefit of this in our particular case, with regard to the examples in this book, is quick, intuitive code clarification. When you look at the functions, you will instantly know what is being passed and returned.

Finally, there is one best practice that we adhere to that is not widely adopted in the Python programming community—functions and methods are kept small in all of our code. If more than one logical thing is happening in a function, we break it into multiple functions and compose as needed. This keeps the code clean and clear, making examples much easier to read. It also makes it much easier to write unit tests without some of the excessive parameterization or awkward, large functions and methods that are often required in unit tests. We hope that this leaves a positive, long-lasting impression on you so that this practice receives wider adoption.

Installing matplotlib

Given that this is a book on an advanced topic and the target audience will have installed matplotlib and the related dependencies more than once (most likely many times), detailed instructions will not be provided here. Two excellent books on matplotlib that cover this topic in their respective first chapters are Matplotlib for Python Developers and matplotlib Plotting Cookbook.

That being said, each chapter will have its own Git repository with scripts to install dependencies and set up Python's virtual environments. These scripts are a great resource, and reading them should provide additional details to those who seek to know more about installing matplotlib and the related libraries in Python virtual environments.

Using IPython Notebooks with matplotlib

Python virtual environments are the recommended way of working with Python projects. They keep your system, Python, and default libraries safe from disruption. We will continue this tradition in this book, but you are welcome to transcend tradition and utilize the matplotlib library and the provided code in whatever way you see fit.

Using the native venv Python environment management package, each project may define its own versions of dependent libraries, including those of matplotlib and IPython. The sample code for this book does just that—listing the dependencies in one or more requirements.txt files.

With the addition of the nbagg IPython Notebook backend to matplotlib in version 1.4, users can now work with plots in a browser very much like they've been able to do in the GTK and Qt apps on the desktop. We will take full advantage of this new feature.

In the IPython examples of this book, most of the notebooks will start off with the following:

In [1]: import matplotlib matplotlib.use('nbagg')
In [2]: %matplotlib inline
In [3]: import matplotlib.pyplot as plt

Tip

Downloading the example code

Each chapter in Mastering matplotlib provides instructions on obtaining the example code and notebook from Github. A master list has been provided at https://github.com/masteringmatplotlib/notebooks. You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you." This configures our notebooks to use matplotlib in the way that we need. The example in the following section starts off with just those commands.

A final note about IPython—the project has recently changed its name to Jupyter in an effort to embrace the language-agnostic growth the project and community has experienced as well as the architectural changes that will make the adding of new language backends much easier. The user experience will not change (except for the better), but you will notice a different name and logo when you open the chapter notebooks for this book.

Advanced plots – a preview

To give a taste of what's to come, let's start up a matplotlib IPython Notebook and look at an example. You will need to download the example from a GitHub repository first:

$ git clone https://github.com/masteringmatplotlib/preview.git
$ cd preview

You only need to do the following in order to bootstrap an environment with all the notebook dependencies and start up the notebook server:

$ make

This will do several things for you automatically, some of which are as follows:

  • Clone a support repository holding various include files
  • Create a Python virtual environment
  • Install matplotlib and other scientific computing Python modules into this virtual environment
  • Start an IPython Notebook server that runs on local host
  • Open a browser window and load the preview notebook in it

In this browser window, you can run the code yourself by selecting each code section and hitting the Shift and Enter keys to execute it. Let's go through an example.

Setting up the interactive backend

As mentioned above, our notebooks will all start with the following, as does this preview notebook:

In [1]: import matplotlib
        matplotlib.use('nbagg')
        %matplotlib inline
In [2]: import matplotlib.pyplot as plt
        import seaborn as sns
        import numpy as np
        from scipy import stats
        import pandas as pd

These commands do the following:

  • Set up the interactive backend for plotting
  • Allow us to evaluate images in-line, as opposed doing the same in a pop-up window
  • Provide the standard alias to the matplotlib.pyplot sub package and import other packages that we will need

Joint plots with Seaborn

Our first preview example will take a look at the Seaborn package, an open source third-party library for data visualization and attractive statistical graphs. Seaborn depends upon not only matplotlib, but also NumPy and SciPy (among others). These were already installed for you when you ran make (pulled from the requirements.txt file).

We'll cover Seaborn palettes in more detail later in the book, so the following command is just a sample. Let's use a predefined palette with a moderate color saturation level:

In [3]: sns.set_palette("BuPu_d", desat=0.6)
        sns.set_context("notebook", font_scale=2.0)

Next, we'll generate two sets of random data (with a random seed of our choosing), one for the x axis and the other for the y axis. We're then going to plot the overlap of these distributions in a hex plot. Here are the commands for the same:

In [4]: np.random.seed(42424242)
In [5]: x = stats.gamma(5).rvs(420)
        y = stats.gamma(13).rvs(420)
In [6]: with sns.axes_style("white"):
            sns.jointplot(x, y, kind="hex", size=16);

The generated graph is as follows:

Joint plots with Seaborn

Scatter plot matrix graphs with Pandas

In the second preview, we will use Pandas to graph a matrix of scatter plots whose diagonal will be the statistical graphs representing the kernel density estimation. We're going to go easy on the details for now; this is just to whet your appetite for more!

Pandas is a statistical data analysis library for Python that provides high-performance data structures, allowing one to carry out an entire scientific computing workflow in Python (as opposed to having to switch to something like R or Fortran for parts of it).

Let's take the seven columns (inclusive) from the baseball.csv data file between Runs (r) and Stolen Bases (sb) for players between the years of 1871 and 2007 and look at them at the same time in one graph:

In [7]: baseball = pd.read_csv("../data/baseball.csv")
In [8]: plt.style.use('../styles/custom.mplstyle')
        data = pd.scatter_matrix(
             baseball.loc[:,'r':'sb'],
             figsize=(16,10))

The generated graph is as follows:

Scatter plot matrix graphs with Pandas

Command 8 will take a few seconds longer than our previous plot since it's crunching a lot of data.

For now, the plot may look like something only a sabermetrician could read, but by the end of this book, complex graph matrices will be only one of many advanced topics in matplotlib that will have you reaching for new heights.

One last teaser before we close out the chapter—you may have noticed that the plots for the baseball data took a while to generate. Imagine doing 1,000 of these. Or 1,000,000. Traditionally, that's a showstopper for matplotlib projects, but in the latter half of this book, we will cover material that will not only show you how to overcome that limit, but also offer you several options to make it happen.

It's going to be a wild ride.

Summary

In this chapter, you got to learn a little more about matplotlib's origins and the latest features that were released at the time of writing this book. You've seen the software that we're going to use, including the version of the Python programming language that we've chosen. Furthermore, we've given you a peek into the future of this book (and matplotlib) with a custom IPython Notebook, which highlights the Seaborn and Pandas projects.

In the next couple of chapters, we're going to focus on matplotlib's internals. In particular, Chapter 2, The matplotlib Architecture will cover the architecture of the project, giving you an insight into how it all works together.

Left arrow icon Right arrow icon

Description

If you are a scientist, programmer, software engineer, or student who has working knowledge of matplotlib and now want to extend your usage of matplotlib to plot complex graphs and charts and handle large datasets, then this book is for you.

Who is this book for?

If you are a scientist, programmer, software engineer, or student who has working knowledge of matplotlib and now want to extend your usage of matplotlib to plot complex graphs and charts and handle large datasets, then this book is for you.

What you will learn

  • Analyze the matplotlib code base and its internals
  • Rerender visualized data on the fly based on changes in the user interface
  • Take advantage of sophisticated thirdparty libraries to plot complex data relationships
  • Create custom styles for use in specialize publications, presentations, or online media
  • Generate consolidated master plots comprising many subplots for dashboardlike results
  • Deploy matplotlib in Cloud environments
  • Utilize matplotlib in big data projects
Estimated delivery fee Deliver to Great Britain

Standard delivery 1 - 4 business days

£4.95

Premium delivery 1 - 4 business days

£7.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 29, 2015
Length: 292 pages
Edition : 1st
Language : English
ISBN-13 : 9781783987542
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Great Britain

Standard delivery 1 - 4 business days

£4.95

Premium delivery 1 - 4 business days

£7.95
(Includes tracking information)

Product Details

Publication date : Jun 29, 2015
Length: 292 pages
Edition : 1st
Language : English
ISBN-13 : 9781783987542
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
£169.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts
£234.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total £ 95.97
Learning SciPy for Numerical and Scientific Computing Second Edition
£24.99
Mastering SciPy
£37.99
Mastering Matplotlib
£32.99
Total £ 95.97 Stars icon
Banner background image

Table of Contents

10 Chapters
1. Getting Up to Speed Chevron down icon Chevron up icon
2. The matplotlib Architecture Chevron down icon Chevron up icon
3. matplotlib APIs and Integrations Chevron down icon Chevron up icon
4. Event Handling and Interactive Plots Chevron down icon Chevron up icon
5. High-level Plotting and Data Analysis Chevron down icon Chevron up icon
6. Customization and Configuration Chevron down icon Chevron up icon
7. Deploying matplotlib in Cloud Environments Chevron down icon Chevron up icon
8. matplotlib and Big Data Chevron down icon Chevron up icon
9. Clustering for matplotlib Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.5
(8 Ratings)
5 star 37.5%
4 star 12.5%
3 star 25%
2 star 12.5%
1 star 12.5%
Filter icon Filter
Top Reviews

Filter reviews by




Justin Marley Nov 24, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very good book with a lot of material including code, graphs and hardware/cloud discussion to take the reader to the next level.
Amazon Verified review Amazon
Loris Aug 11, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I bought this book with the goal of improving my basic knowledge of matplotlib: while the creation of basic plots is straightforward, I found it difficult to modify the default behaviors of the library, and I faced problems in plotting large amount of data. I can safely say that this book helped me to solve both issues. As the author mentions in the book, a prior knowledge of matplotlib will definitely makes the reading more enjoiable.The book begins by giving an historical overview of matplotlib and by introducing two popular projects, seaborn and pandas. The chapters that follow describes the matplotlib internal architecture and its API. Next the author illustrates how events are handled in matplotlib and how to create interactive plots. The fifth chapter is dedicated to high-level plotting and shows how to create plots with third-party libraries, such as networkX, pandas, and seaborn, which wrap matplotlib functionality. The chapter also briefly introduces Bokeh, a library that offers a series of improvements over matplotlib and focus its attention on the web browser. In this chapter the author did a very good job in showing how a good visualization of the data is crucial in data analysis. The next chapter covers the customization (and the configuration) of matplotlib. Here the author shows how to create complex layouts where different plots are combined in the same figure. In the eight chapter the author explains how to plot huge amount of data by illustrating different strategies that range from using tools such as numpy's memmap function and pytables, to decimating data (removal of a fraction of the data). The last chapter shows how it is possible to improve the performance of matplotlib by using a clustered environment.Last but not least, the authors provided a GitHub repository with the example code and notebooks of each chapter of the book.
Amazon Verified review Amazon
Ro'eh Nävee May 12, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
'Mastering matplotlib' is a textbook for someone acquainted with using the Python library named 'matplotlib.' Also the IPython/Jupyter interpreter, since the 'nbagg' IPython Notebook backend to matplotlib will also be used. The 'nbagg' backend is for working with plots in a Web browser. Other Python libraries were SciPy, NumPy, Pandas and Seaborn.Most Jupyter notebooks in the tutorials start with:import matplotlibmatplotlib.use('nbagg')%matplotlib inlineimport matplotlib.pyplot as pltOne convenience to appreciate is how the author listed dependent libraries featured in the textbook, and even stored them in a text file included within the accompanying code, which can be downloaded for free from Packt Publishing. The generous author even states: "...you are welcome to...utilize the matplotlib library and the provided code in whatever way you see fit." Free practical, usable code. Once the free code has been downloaded, the github.com repo masteringmatplotlib/notebooks is optional. Mastering matplotlib
Amazon Verified review Amazon
G. A. Patino Aug 12, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This is the definite book to learn the most advanced aspects of matplotlib. Even though the book covers installation and gives the fundamentals about basic plots, it is best suited for intermediate users in both Python and matplotlib. In fact, the authors are very class-oriented, making a fair familiarity with object-oriented programming something of a prerequisite. However, if you have those prerequisites the book is a worthy investment as you will be able to take full advantage of matplotlib.Even though the topics covered are advanced, from the matplotlib architecture to deploying it in Docker and implementing in parallel computing, they are presented in a clear and concise way. Yet the breadth of applications covered is quite comprehensive, and the authors are able to articulate all the different chapters so that the learning feels like a natural progression instead of trying to cram very disparate subjects. The code is elegant and relatively short, facilitating its reading; and the authors explanations for it are very easy to follow. In particular, the chapter of big data visualization definitely goes beyond what is presented in other books that also cover the same topic, and the implementation explanations are much better. The fact that the book is under 300 pages long is a huge plus. The only chapter I felt that wasn't as easy to follow is the one on GUI deployment.One aspect I really enjoyed about the book is the multiple explanations about the different approaches to creating figures with matplotlib. When you are learning Python and matplotlib you see some books that use pyplot, while others use pylab. Or some like the ax. synthax while others stick to the plt. one. This is the first book in which I see a presentation of all those possibilities, along with their advantages and disadvantages. By the same token, if you are confused as to when to use Seaborn vs yhat ggplot, what's the point of NetworkX, what is ModGrapher, etc. you will find all those explanations here, along with suggestions for their appropriate application.
Amazon Verified review Amazon
NRK Aug 14, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
I was hoping for a systematic understanding of the package. Didn't get it.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela