Book Image

NumPy Cookbook - Second Edition

By : Ivan Idris
Book Image

NumPy Cookbook - Second Edition

By: Ivan Idris

Overview of this book

<p>NumPy has the ability to give you speed and high productivity. High performance calculations can be done easily with clean and efficient code, and it allows you to execute complex algebraic and mathematical computations in no time.</p> <p>This book will give you a solid foundation in NumPy arrays and universal functions. Starting with the installation and configuration of IPython, you'll learn about advanced indexing and array concepts along with commonly used yet effective functions. You will then cover practical concepts such as image processing, special arrays, and universal functions. You will also learn about plotting with Matplotlib and the related SciPy project with the help of examples. At the end of the book, you will study how to explore atmospheric pressure and its related techniques. By the time you finish this book, you'll be able to write clean and fast code with NumPy.</p>
Table of Contents (19 chapters)
NumPy Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing matplotlib


matplotlib (all lowercase by convention) is a very useful Python plotting library, and we will need it for the following recipes as well as more later on. It depends on NumPy, but in all likelihood, you already have NumPy installed.

How to do it...

We will see how matplotlib can be installed on Windows, Linux, and Mac OS X, and also how to install it from source:

  • Installing matplotlib on Windows: You can install this with the Enthought distribution, also known as Canopy (http://www.enthought.com/products/epd.php).

    It might be necessary to put the msvcp71.dll file in your C:\Windows\system32 directory. You can get it from http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71.

  • Installing matplotlib on Linux: Let's see how matplotlib can be installed in the various distributions of Linux:

    Here is the install command on Debian and Ubuntu:

    $ sudo apt-get install python-matplotlib
    
    • The install command on Fedora/Redhat is as follows:

      $ su - yum install python-matplotlib
      
  • Installing from source: You can download the latest source from the tar.gz release at Sourceforge (http://sourceforge.net/projects/matplotlib/files/), or from the Git repository using the following command:

    $ git clone git://github.com/matplotlib/matplotlib.git
    

    Once it has been downloaded, build and install matplotlib as usual with the following commands:

    $ cd matplotlib
    $ sudo python setup.py install
    
  • Installing matplotlib on Mac OS X: Get the latest DMG file from http://sourceforge.net/projects/matplotlib/files/matplotlib/ and install it. You can also use the Mac Ports, Fink, or Homebrew package managers.

See also