 Hello, and welcome back to the video series for this lesson. We're going to go ahead and dive into how we can visualize data and create plots using plot 9 and ggplot in Python, and we're going to demonstrate this through bar charts today. So here we are in Google Colab. This is the same file that we were working with to import and clean the data. So we've got our libraries here, we've got our file read in and imported, and then we did some cleaning to ultimately remove and then rename the remaining columns. So with that, let's go ahead and dive in. So generally bar charts are going to be used to display some sort of categorical variable, and here we're going to demonstrate how to display counts for that. So this is, in effect, similar to a frequency table, but just in graphical form. And so we're working with ggplot, and for most of the ggplot lectures, I'm actually going to wrap the whole command within a set of soft parentheses, and this just helps me to enter down in between different parts of the ggplot command, make it a little easier to read. So with any ggplot figure, we start off with the ggplot command, and we give it whatever our data frame is called. Here I call it survey. And then we add in the geome. And for bar charts, that geome is known as geome bar, and the final piece that we always need is the AES or aesthetics mapping. And in this case, all we need to do is specify a categorical variable for our x-axis. But we're not quite done. If we go outside of the AES parentheses, we need to set the stat equal to count. So this tells Python what statistical measure, what calculation you want to show on the y-axis. And then for demonstration purposes, we can add a fill color again outside of that AES statement. And so we can run this, and we can see how the count by major looks. And so when we took this particular survey, we had the majority of students from the PNGE major with a few from Energy Engineering and EPF. Well, the other majors were very small groups. But this is a primary way to use a bar plot, showing a categorical variable with counts on the y-axis. Occasionally, you will want to show a quantitative variable on the y-axis that isn't just the count of how many were in a category. We want to see how many credit hours were being taken by all the students within their different majors. And for that, we can also do a bar plot, but we need to change it just a little bit. And so we'll start off again with these open and closed parentheses, and then our ggplot command for survey. And then we're still going to do a bar chart. So we still say June bar, and then we have AES. And so we have our categorical variable on the x-axis. And now we left it at here for the above plot, but for this particular plot, we are going to add a y-axis with credits. So this is a quantitative variable that will now show up on our y-axis. But once again, we still need to add a stat regardless of what type of bar plot we're doing. And in this plot, we're going to say stat equals identity. And this means use the data as you see it. Don't do any calculation on it. Just identify what those values are and plot them. And then we'll also add a fill. And in this case, I'm going to show you a slightly different way to do, to set colors. And that is through these hex codes. So these are six digit long codes that are a mix of numbers and letters, and they all attach to a specific color. And so if you're ever interested in using a certain color palette, you can find these hex codes fairly easily online. This particular hex code is for a very dark blue that is almost black. But here we see our plot. We've got our categories, our majors on the x-axis. We've got credits, our numerical variable on the y-axis. And we can see that it has plotted those variables. And it's actually plotted them as like a total. And so you can imagine that each of the credit hours for an individual student has been stacked on top of each other for a total value based off of the majors.