1 00:00:00,480 --> 00:00:06,160 Welcome back to another class of the complete introduction to data science with the use of Python. 2 00:00:06,750 --> 00:00:12,870 So this class will be our last class about matplotlib and that basically we are going to learn to create 3 00:00:12,870 --> 00:00:17,190 another type of graph or chart inside of this class. 4 00:00:17,460 --> 00:00:23,750 So up until now, you guys understood what is Muttalib and what is a visualization tool. 5 00:00:24,220 --> 00:00:24,630 All right. 6 00:00:24,640 --> 00:00:28,290 So into this class, we are going to create a scatter plot. 7 00:00:28,290 --> 00:00:31,650 So basically, this is a plot with dots a bit everywhere. 8 00:00:32,010 --> 00:00:35,610 So it's pretty simple to create and pretty simple to understand. 9 00:00:35,640 --> 00:00:39,890 So basically, it's going to make a cloud of dust, which is pretty cool. 10 00:00:39,900 --> 00:00:41,550 You'll see what it looks like. 11 00:00:42,120 --> 00:00:46,810 So, as always, the first part is to create is to import matplotlib that pipework. 12 00:00:47,700 --> 00:00:55,800 Then we'll create our little database with X and Y, so for the X and Y axis, then we'll just give 13 00:00:55,820 --> 00:01:02,850 a title to our graph as well as a title for the X axis and the X and Y axis. 14 00:01:03,480 --> 00:01:03,870 All right. 15 00:01:04,410 --> 00:01:05,460 So let's start. 16 00:01:05,940 --> 00:01:17,410 So first thing, as I said, we will import math lot, Leyb, that pipework as Kielty. 17 00:01:17,430 --> 00:01:21,080 So this is what we always do then. 18 00:01:21,090 --> 00:01:21,960 It's pretty simple. 19 00:01:22,350 --> 00:01:26,740 We need to write down something for the X's and the whys. 20 00:01:26,750 --> 00:01:33,840 So basically we can we will have our X axis right here and let's say we'll have five. 21 00:01:33,840 --> 00:01:41,070 That's in our x axis, which would be three, six, seven, nine and let's say 10. 22 00:01:42,330 --> 00:01:43,020 So here we go. 23 00:01:43,020 --> 00:01:44,280 We have our existence. 24 00:01:45,180 --> 00:01:49,290 Then the next thing will be having something for our y axis. 25 00:01:49,710 --> 00:01:55,290 So let's say it's going to be in this case, five. 26 00:01:56,330 --> 00:01:57,800 Ten, twenty five. 27 00:01:59,110 --> 00:02:01,670 Three and one, all right. 28 00:02:01,690 --> 00:02:06,620 So right now we have five dots, five X's and five white. 29 00:02:07,090 --> 00:02:11,570 Next thing will be giving a title to our database. 30 00:02:11,590 --> 00:02:13,440 Well, not in our database to our graph. 31 00:02:13,450 --> 00:02:15,760 So basically, we will write down the title. 32 00:02:15,770 --> 00:02:18,070 So same thing, that title. 33 00:02:21,120 --> 00:02:23,670 And let's call it once again test. 34 00:02:27,900 --> 00:02:39,570 Then we need the x axis and the Y axis, so t x labels will give a name to X. So. 35 00:02:40,820 --> 00:02:42,470 This takes. 36 00:02:44,660 --> 00:02:49,010 And BLT wisely, so we need a name for Weiss. 37 00:02:52,380 --> 00:02:56,580 That's why, all right, so right now we have everything that we need. 38 00:02:57,300 --> 00:03:03,240 Now it's time to write down the function that will allow us to create the chart and in this case is 39 00:03:03,240 --> 00:03:05,280 going to be that scattered. 40 00:03:06,630 --> 00:03:08,180 So we have our function right here. 41 00:03:08,550 --> 00:03:11,020 And what will be the arguments inside of this function? 42 00:03:11,040 --> 00:03:11,670 It's pretty simple. 43 00:03:11,670 --> 00:03:14,880 It's going to be X and Y that we have right there. 44 00:03:14,890 --> 00:03:17,510 So we'll write it down X and Y. 45 00:03:17,970 --> 00:03:19,410 So we have our two arguments. 46 00:03:19,800 --> 00:03:25,800 So next thing that we need to do is simply run or we'll write down fields that showed to be able to 47 00:03:25,800 --> 00:03:27,060 run everything that we have. 48 00:03:29,100 --> 00:03:29,710 So here we go. 49 00:03:29,820 --> 00:03:33,460 And as you can see, we have all our ducks right here, so it's pretty simple. 50 00:03:33,480 --> 00:03:38,880 We have our first dart, which is three and five, works perfectly, then 10 and six. 51 00:03:38,890 --> 00:03:46,830 So basically we have the six and the 10 right here, then seven and twenty five works well, nine as 52 00:03:46,830 --> 00:03:47,790 well as three. 53 00:03:47,790 --> 00:03:48,750 So it's right here. 54 00:03:48,750 --> 00:03:50,770 And finally 10 and one right there. 55 00:03:51,120 --> 00:03:54,210 So everything works perfectly as you guys can see. 56 00:03:54,630 --> 00:03:58,950 Another thing that we can do right now is, as always, changing the style. 57 00:03:58,960 --> 00:04:01,440 So what we'll do, we'll import the package. 58 00:04:02,550 --> 00:04:08,100 So from matplotlib import style. 59 00:04:18,720 --> 00:04:27,720 All right, and we can watch the news and here we can choose the type of style that once, once again 60 00:04:27,720 --> 00:04:33,480 will use the classic stuff and we can run everything and see what it looks like. 61 00:04:33,510 --> 00:04:35,760 So as you can see, everything behind is great. 62 00:04:36,210 --> 00:04:44,250 So this is the main well, the main difference that we can see here is this is pretty simple to work 63 00:04:44,250 --> 00:04:44,550 with. 64 00:04:44,550 --> 00:04:45,350 In my opinion. 65 00:04:45,360 --> 00:04:47,780 This graph is pretty simple to create. 66 00:04:48,000 --> 00:04:53,640 And well, once again, you can do a lot of really interesting things with this visualization tool in 67 00:04:53,640 --> 00:04:53,940 general. 68 00:04:53,940 --> 00:04:59,520 So it's really an interesting visualization to sort that we saw in the best two classes, different 69 00:04:59,520 --> 00:05:02,250 graphs that you guys can create with matplotlib. 70 00:05:03,870 --> 00:05:07,080 You can do many more things so you can create two graphs. 71 00:05:07,080 --> 00:05:07,920 At the same time. 72 00:05:07,920 --> 00:05:11,840 You can do pretty much what a lot of things to visualize your data. 73 00:05:12,180 --> 00:05:18,960 But right now it's really up to you to practice all this and you can do really amazing things with matplotlib 74 00:05:18,960 --> 00:05:19,320 alone. 75 00:05:19,350 --> 00:05:25,860 So this is really an amazing visualization, too, and it can be a really good thing to instead of having 76 00:05:25,860 --> 00:05:31,180 matlab using matplotlib since it does pretty much the same thing. 77 00:05:31,650 --> 00:05:38,040 So you guys like this part of the course because this was the last class of matplotlib and see out in 78 00:05:38,040 --> 00:05:40,290 the next part of this course.