Hi folks. Welcome back to our Module 3. This is the course Python packages for data science. Module 3, we're going to learn a very useful package that you are going to use for data visualization in data science. Actually Module 4 is another data visualization package, which is seaborne. These two together will serve well for the purpose of how to communicate your data very well. Let's get started. For this module, we're going to learn matplotlib, as we have already learned in previous modules. In order to use a external package, we need to import it. Here, the first cell is to import the matplotlab.pyplot as plot, as plt. This is a little bit more complicated than what did we imported before as the pandas as pd and numpy as np. For here we are in convention. Just import one portion of the matplotlib package and we name that portion as plt. Rather than import the whole package, we only use a part of it. This is another way of import without import the whole package, we can just choose the part of the package you will want to import. Another convention is the plt. The same logic as the pd for pandas, np for numpy, we use plt for matplotlib. Whenever you see these one plt, it represents matplotlib.pyplot. This is a convention in the field. If you see that or if you use that, people will assume you accept this convention. Let's import these three needed packages. As you know, numpy is good for dealing with multidimension or an dimension arrays. Pandas is specialized for tabular data. Actually we can generate a lot of useful, interesting dataset just to simply use numpy and pandas. Here is a example, we learned numpy can generate array, and that array is consists of numbers in the range and here is x is in a range of 0-9, and the step value is one, and y will be another range of or array of integers from zero to 1,000. We just stepped value of 100, this 1,000, 100 has to be included. Basically, x will be 0, 1, 2 up to 9, and y will be 0, 100, 200 up to 900. While they are separated as two arrays, we cannot find any interesting pattern from them directly. However, if we can use a plot to show how the xs and ys are associated, how they change together, how they affect each other. We can find a more meaningful information from the two arrays as we are doing right now. This plot actually shows that axis is on the horizontal axis and the y is on the vertical axis. We see that x and y follows a perfect relationship, that is when x increases, y will increase as well, and also the scope of the increase is exactly the same. Basically, it is a straight line. If it is a formula, what is the y in terms of x? We can simply do that. This simple plot just shows the same thing. Just to talk about with thousands of words. This plot, just it shows how x and the ys. X is on the horizontal and the y is in your vertical, how they are related. One simple graph can show a lot of information in it, and we should be ready for using the advanced data visualization tools, including matplotlib to discuss and communicate your data with your clients and colleagues. The next one is a little bit similar. We learned numpy can generate random numbers, random integers, and a random floats in the generating the random numbers can follow a certain distribution as long as we specify. For here, we're going to specify x. As a numpy generating the random floats, and the float number is distributed following the normal distribution with a mean of 0.5 and standard deviation as 0.1 and it has the shape as 100, one dimensional. These xs will be sorted so that we can have the number from the least to the greatest. Now we simply define y is x^2, which we know it is a relationship. When x increases, y will increase as well. We're going to print out these x and y to see what are their actual number, and then we're going to plot them just to call plt as a matplotlib, that plot. In this plot, we simply, just to provide the plot as a function with two parameters. The first argument is x, which works for the values on the horizontal axis. The second argument will be y, works as the values on the vertical axis. That's executed and see what they are. Because we have 100 numbers for the xs and the ys, so we will see a lot of numbers seeing here. We can see that those numbers are ordered from the least to the greatest both the x and ys. We can find out the relationship is not a straight line, but a curve. That curve follows exactly y equal to x squared. Because x is less than one, so we see that the x is square, is actually less than x. That is, shows in this picture nicely. This is just a very simple use of the matplotlib, as we can see, this is very simple. We just recall import, get the matplotlib.pyplot as plt. Then we have some data. Those data will be erased, will be lists, and will be numpy, arrays, etc. Then we just call the plt.plot and then three to two arguments represents each of the issue of the axis. Then we can get the result quite easily. Everything else is just about default. We're going to stop here and after the break, we're going to come back and continue with some modification of this default call for the matplotlib. I'll see you later.