**NumPy and Matplotlib**

Python, it is the most preferred language for Data Science. It has many packages and libraries which enhances the data visualization and interpretation. The packages enable programmers toget maximum productivity. Among the packages that Python offers, are NumPy and Matplotlib.

**NumPy**

NumPy is also called the numeric Python. It is a python package that provides other options for a regular Python list like the NumPy n-dimensional homogenous array. It is the core library for scientific computing. It also offers a high-performance multidimensional array object and the tools for working with these arrays.

NumPy is helpful even while performing the most complex scientific calculations on these arrays. These calculations include linear algebra, matrix multiplication, and matrix manipulation, among others.

*Arrays*

A NumPy array is a grid of values, with the same type. It is indexed by a tuple of non-negative integers. The number of dimensions becomes the rank of the array. Also, the shape of an array is a tuple of integers giving the size of the array along every dimension.

**Installing Numpy**

Just as seen above, the arrays are quite useful. Therefore, the next question becomes, where do we get them? Well, to get them we can use it (pip install numpy) in the command line of your computer, or you can contact a Scientific Python Distributor.

Having installed Numpy, you need to import it as it is not ready to use yet. To import it, you can type the ‘np’. Then you are now set to use the Numpy tool like other data scientists.

**SubsettingNumpy Array**

Numpy arrays are similar to the Python lists. An element in Numpy array is selected through the same way as you would do in Python list. Numpy has a special way of subsetting an array, and that is by using an array of Booleans. For this, you will just have to make the Boolean array using the conditions and pass that array as an object to the Numpy array.

**Features of Matrix in Numpy**

- Multiplication: In Numpy, you can perform the regular multiplication of matrix.
- Transpose: This is the same as matrix, but it has rows of the original matrix as the row of the new matrix. It is always done using matrix.T method.
- Determinant: To get the determinant in a matrix, you use linalog module. It is a determinant which can be calculated using the np.linalg.det.
- Inverse: The inverse can be calculated in a similar way as that of calculating the determinant using the linalg module.

**Numpy Statistics**

Having known most operation and tools in Numpy, we can now expand our scope. How will you handle a large amount of data in machine learning? To get something substantial, you need to get some statistical analysis on it, and NumPy is a great tool for that. The main statistical operations are median, mode, standard deviation, variance, and mean. The aforementioned operations can be done on rows or columns.

**Matplotlib**

Matplotlib is a library for plotting 2D graphics in Python programming language. It is similarly used in shell, python scripts, webapplication servers and other graphical user interface toolkits.

Matplotlib can be imported into the Python script by adding the following statement:

From matplotlib import pyplot as plt

**Basics of Matplotlip**

The simplest of all plots is the line plot. It takes two arrays as an argument. Herein, you will learn about various aspects of plotting a line plot.

- Label: You can add the x and y-axis of a graph.
- Title: To set the title of your plot, you can use the plot title.
- Ticks: You can label the position of the x and y-axis according to your choice.
- Figure Size: You can increase or decrease the size of the plot using method.

There are some few toolkits which are available and extend the python matplotlib functionality. They are as follows:

- Basemap: This is a map plotting toolkit with various map projections, coastlines and political boundaries.
- Cartopy: It is a mapping library featuring object-oriented map projection definitions, and arbitrary point, line, polygon and image transforming capabilities.
- Excel tools: Matplotlib offers utilities for exchanging data with Ms Excel.
- Mplot3d: This one is used for 3-D plots.
- Natgrid: It is an interface to the natgrid library for some irregular gridding of the spaced data.

**Customizing **

While making a graph, you can make it more appealing through customization. Customizing the graphs makes it easier to comprehend and to interpret quickly.

You can customize the:

- Colour
- Marker
- Linestyle
- Types of Plots

NumPy and MatplotLibare often used together to provide an effective open source alternative for MATLAB.