Book Image

NumPy Cookbook

Book Image

NumPy Cookbook

Overview of this book

Today's world of science and technology is all about speed and flexibility. When it comes to scientific computing, NumPy is on the top of the list. NumPy will give you both speed and high productivity. "NumPy Cookbook" will teach you all about NumPy, a leading scientific computing library. NumPy replaces a lot of the functionality of Matlab and Mathematica, but in contrast to those products, it is free and open source. "Numpy Cookbook" will teach you to write readable, efficient, and fast code that is as close to the language of Mathematics as much as possible with the cutting edge open source NumPy software library. You will learn about installing and using NumPy and related concepts. At the end of the book, we will explore related scientific computing projects. This book will give you a solid foundation in NumPy arrays and universal functions. You will also learn about plotting with Matplotlib and the related SciPy project through examples. "NumPy Cookbook" will help you to be productive with NumPy and write clean and fast code.
Table of Contents (17 chapters)
NumPy Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing Matplotlib


Matplotlib is a very useful plotting library, which we will need for the next recipe. 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 in Windows, Linux, and Mac, and also how to install it from source.

  • Installing Matplotlib on Windows: Install with the Enthought distribution (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:

    • The install command on Debian and Ubuntu is as follows:

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

      su - yum install python-matplotlib
      
  • Installing from source: 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 as usual with the following command:

    cd matplotlib
    python setup.py install
    
  • Installing Matplotlib on Mac: Get the latest DMG file from http://sourceforge.net/projects/matplotlib/files/matplotlib/, and install it.