[MUSIC] Hi, in this video clip, let me explain how to draw a line graphs and bar charts. Plot is used for drawing line graphs. But surely, originally Platt function is created for drawing line graphs, but it can be used for drawing other types of graphs. So it is very flexible tool for creating graphs, bar chart is used for presenting categorical data values. There are multiple categories and for each category there are specific numbers. What if there are 4 students in a class, each student on the certain grade for each subject. In that case, those kind of data can be presented with a bar chart. So bar chart is especially useful for presenting categorical the data values. The high total bar is used for presenting the values of categorical data. So first, let me explain, I like drawing line graph, I already show you how to draw line graph in the previous video clip. So in this case, let me give you an example, a little bit more complex compared to the previous one. In this case, you are presenting 3 variables, so we are using Platt function before using that one we created x variable. x axis is variable using dumpi for orange function, starting number is 1, ending number is 9 and the step is one half, 0.5. So there will be 18 data point, 1,1.5,2,2.5, 9 is not inclusive, right? That x value is useful x axis, there are 3 line grab, so the first x tell you sir, the same. It means that the line, 3 line graphs share the common x axis, and then y value in the first case is x again, so it is linear line graph. b in this case is color of that line graph, blue. At this time the y value is powered by 3 over 2 right? And the colors are red, and the marker for this line graph is attack, here is this is attack. And here hyper means that it is, does a connected by a line, and the third line is skill route or backs. So y value matching to x, in case where third line graph is square root x. Color g means that green color, s is for shape or marker, s stands for square, so square marker will be used. If you want to add title to a graph, here is only one graph. We on that one graph, we are presenting 3 line graphs sharing the same x axis. So one title is enough, so both progress with the same x values. That is the tittle of the figure, and also I added another command line grid, we are drawing grid on that graph. Each to read data point with grid, and as a lady explained the last line is PLT does show. Let's see the outcome, nicely drawn and beautifully drawn, easy to read. What if we make grid command dormant? Then it looks like this one, and there is no grid but we create with grid, easy read the data point. And what if here we remove hyper? Then the circle dot, red dot, those red dots are not connected. And also if you use 2 hyper, what happens? The line it's not solid, it is started line, if you do not use- No hyper that are not connected. But at this time as you see, if you use only color information then the default is solid line, solid line and at this time square. Shape is square, color is green, but squares not connected. Now let's see another graph example, I'm using rip Linspace function starting number, zero and this is the ending number. In case of a Linspace function, the second number is inclusive. And how many data point is created within that range between zero and this ending number 400 data point where we create? And then these x values is 3d, 2ds, y function, rip sin function. So those numbers are converted into sin values, it means that we are drawing a sin graph using x and y variable. So I don't need to explain this one, canvases created here and plotting x and y, I'm designating x variable and y variable. I'm not stating any color information, then automatically python of science, default color. I added title, at this time I'm adding x label and y label. x label is used for the labelling of x axis, y label is used for labelling of y axis. So x-axis represent the values of x, so x range, I used the label and front side this trap. So you risk this parliament of fantasize, you can control the size of fund for the title and four x label and wide label. Here's I'm adding greed and at this time let me explain this safety Plt save feed and this is a subdirectory image. And the name of a sign grab dot PNG will be created and stored in a subdirectory IMG. Let me show you a subdirectory here, IMG is here right on the coasera directory. Here's why I am putting all image files here so less access to that subdirectory IMG then there's no no sign graph that PNG soon they will be created after executing the cell. The image will be stored so let me exit this way then sign graphics created here and this graph has x. x is labelled and y-axis label and let's go back to the I am just subdirectory in order to see whether or graph is created here. Sine graph PNG is created if you double click, you were sick, this is the benefit of using jupiter lab. The data file, you can see directly here the graphic fire, you can also view the graphic fire by clicking the file, so this is actually what is creative. But at this time the x label is not looking good, so there's something and why access label is not showing, it's not shown. So somehow we need to change the figure size like six and four, then probably all will be fine. So this is what you see and what we can't you fire Now here's why label and X label. So sometimes if the start figure, is that the same as what you see in the cold? You need to adjust the size of figure, right? So closing it and then go back to the coding environment, so now let me explain. Yeah, throwing part chart at this time, I'm going to show you how to draw bar chart and here's one data. A number year will take those string information, first year, second year, third year, first year and another list contains interior values. Assume those interior values are number of registered student in each year. So and those lists contained in a tuple and the total information is unpacked too. A year and number using you, n number we are drawing part chart, this is an example categorical data, right? So figure sizes I created 12 by 4", right, there are two surplus 1 to 1. 1 to 1 means that wrong number, this one column number is two, so two figures will be placed side by side, not up and down. And the left one, is this one the right side one is this one and your number with information? Yes, now provided color is right with here means that the size of power with a global power. So even if you do not give this information then default value will be used. And at this time we are using path function or and H vertical bar chart in order to draw a vertical bar chart parcher. Do you use this power function in order to make the same chart horizontally? You need to use power H function, so let me ask you the cell then you see this one in case of 2nd 1 is G and also at this time with information 8. So the resto bar is far wider, then the other case. What if we use this one then that is the maximum value then or vaasa connected, there is no empty space between powers. So for what if I change it into 0.4, then quite similar to don't left aside using this with perimeter you can control the width of EG. Bar and title white labor, I don't need to explain that year and greet function because I already explained those command lines at the end. I'm also using PRT the show in order to clear the memory yours. Now let me introduce another case of drawing part chart In this bar chart, we just oppose to different information for example the data set looks like this one name list contains for persons names. Another list tipple is unpacked tTV watching time and social network service usage time by each individual, so 40 minutes 50 minutes 60 minutes 17 minutes. Those are the time spent for TV watching by the four persons and another variable name on the bar I is created. Np arrange length is the name means that length is four, it means that name under my I, this variable is MPR. A, containing numbers from 0 to 30123, this entity information will be used for locating those label information. There are four persons name. Those will be used for labors of x axis. But somehow we need to place those labor information on the x axis. So in Tunisia is used for ordering of these name labels with determines the risk of bar chart, right? So those parameter values, so I've already said and then I'm creating a canvas And then I met in two bars. The first one is for tv on the bar, watching tv watch time. The second bar is used for as soon as youth with, the information we are using or signing the same with for each variables. That's why I created one parameter value and using here, color in case of color L and G label is TV and SNS. So far explained all the parameter values used in bar chart but accepted the first one. Look carefully name on the bar I, those giant teachers minus with divided by two with divide by two. Because I'm presenting to data side by side, they are simply locating side by side in order to compare for each person. So help with is used for placing label of the each individual. So I will show you the graph then is better to first to show the graph then is easy to explain. Now two graphs are locating side by side and here's John Salley, Harry Smith. Those names are placed in the middle of the two bar chart and here's label information is used for showing legend and location parameter of percent. That's why is located at this place percentage and here's title information and x takes x specific, fine location of name, a person and this name on the by useful pinpointing the location of John location of a Sally location of Harry location of a Smith. So in order to make their name exact here, staying at the middle. You are using width divided by two, width divide by two. So by doing so from the middle point one is sdded one is subtracted. That's why it is John is exactly is located in between the two bar chart, right? So this is a way of creating a graph presenting multiple variable information on the same graph. The next case is simply presenting the same case but different method. I'm using fig and accept plus function. That's what I already explained, yeah. So canvases created and once one grab one area dot com whole canvas will be used for presenting this object Axx. And two Ax I am adding to our functions. The Syntex is exactly the same as a verb but at this time xt's and xt labels at this time set on the bar xt's. It is location information set on the by xt labour's, labor information matching to this xt's. This is the only difference between the above case and this case. The remaining syntax is exactly the same. So let me show you the outcome, outcome is also exactly the same, right? Because I used the same data and used the same syntax in most cases. But the way you were creating canvas and graph is slightly different in this case compared to the other case. Before closing this, a video clip, let me give you another leave your question to all of us. Bar chart is useful appropriate ending graphically categorical counts, yeah. Bar chart is especially useful for presenting categorical counts graphically. So the answer is true.