Hello, my name is Brian Higgins, and. In these lessons you will learn how. To find the distribution of data using histograms. We'll generate random data to plot as a histogram. We'll then add styling options to our histograms. And then we will create subplots for a histogram. In this lesson, we'll generate random data to plot as a histogram. First you may ask what is a histogram? A histogram is a plot using rectangles. Showing the frequency distribution of a set of continuous data in successive numerical intervals of equal size. This enables inspection of the data for its distribution type. So, for example, a normal distribution, statistically. Speaking, you can also look at for. Outliers, skewness and other statistical information. Usually the independent variable is plotted horizontally. And the dependent variable is plotted vertically. In contrast, a bar graph different from a histogram shows categorical data where each bar represents a category. There is normally a gap between the bars in a bar graph as opposed to the histogram, where there is no gap between the bars. Let's start doing some coding and generate a histogram in our first code block. Here we will import the Matplotlib library. As we've done before, but using the Pi plot sub library and our alias PLT. Additionally, for this exercise, we'll import the NumPy Python library that we can use to generate a random distribution of numbers. We will alias this library as NP. Let's execute that code. Okay, so we've imported those libraries. Next, we will generate a random distribution. Of numbers using that NumPy library. So in this example, we'll generate a. Random distribution of 100 numbers. So we'll assign NUM to be the value of 100. And we'll call our NumPy random libraries rand function. Passing in that NUM, which has a value of 100, will generate a list. Of 100 numbers in a variable called x. Let's execute that. Okay, and there you see the list of our random numbers, 100 numbers randomly generated. Next we'll visualize that distribution of random. Numbers with a histogram. So we'll call PLTs, or our Pi plots hist function and pass in our list of 100 numbers called x. And then we will show that plot. Okay, so you see our plot of. Random numbers in this figure here. And next what we'll do is generate a normal random distribution of numbers using the NumPy library. With this, you define how many random numbers you want to generate, as we've done already. But for a normal distribution, the random numbers will have a mean and a standard deviation. So a mean will be the average. So first we'll assign a mean to a value of zero, a standard deviation to a value of one, and we'll generate 100 of these numbers. Again, we'll call NumPy's random Library. This time we'll use the normal function. And pass in our mean and standard deviation and 100 values to be generated in our NUM variable. And that will be assigned to our x list. And then we'll print our list of numbers out. So again, here's our list of numbers that have a mean value of zero. So you'll notice the values are less. Than and greater than zero, and that's because our mean is zero. So let's draw a histogram of those numbers again calling our PLT libraries hist function and passing in our list called x. Okay, so if you notice in the plot that was generated there, our numbers. Have a mean around zero. So you'll notice the highest bar there is close to zero. Lastly, we'll generate a bimodal distribution. A bimodal distribution of numbers has two means. So what we'll do is generate two lists of random numbers where each list. Has its own mean and we'll concatenate. Them together and then plot that list. So, each list will have 400 numbers. We'll assign the variable mu, meaning the. Mean sigma being standard deviation for the. First list is ten and 40. The second list is mean mu two and standard deviation sigma two will be 105. And then what we'll do is generate. Two random lists of normally distributed numbers with the variables that we assigned. So our first list is x one. That has a mean of ten. Our second list is x two with a mean of 100. So we'll generate those x one and x two lists. And what we'll do then is call NumPy's concatenate function and we'll pass in the first list and add the second list x two to x one. And we'll create a new list called x. And then we will plot using again the hist function with this list that will have two means in it. And again, this is a bimodal distribution. And we'll take a look at that and we'll see the two means are obvious from our plot. So again, the first list had a. Mean of around ten. You'll see that as the first spike in the bars. And then the last spike is the list of numbers around 100 it. So there are two means shown here. Thanks for watching and stay tuned for our next lesson where we'll add some styling options to our histogram.