1 00:00:00,720 --> 00:00:01,510 Okay. 2 00:00:01,660 --> 00:00:02,730 Welcome back. 3 00:00:02,730 --> 00:00:09,420 So in the last video we said that there were two options for subplots but the beautiful thing is that 4 00:00:09,420 --> 00:00:14,930 we can use the same command we've been using for single plots to create subplots. 5 00:00:15,030 --> 00:00:17,150 So we've seen a preview of option 1. 6 00:00:17,910 --> 00:00:18,810 Let's do option 2. 7 00:00:18,810 --> 00:00:22,600 Just because if you come across these I want you to be aware of it. 8 00:00:22,620 --> 00:00:28,330 Option 2 in your research you might see both of these come up. 9 00:00:28,330 --> 00:00:31,630 So that's why we're checking out two different ways do you have to use two different ways. 10 00:00:31,630 --> 00:00:32,620 No you don't. 11 00:00:32,620 --> 00:00:38,170 We'll probably stick to using option one throughout the rest of the series but this is just so you know 12 00:00:38,230 --> 00:00:39,040 what's going on. 13 00:00:39,410 --> 00:00:43,630 So go figure and ax while this syntax looks different already. 14 00:00:43,630 --> 00:00:51,370 This is just like we're making one but rest assured we are creating subplots and rows and Coles equals 15 00:00:51,370 --> 00:00:51,990 two. 16 00:00:52,150 --> 00:00:55,790 And then we want fig size we're just replicating what's here. 17 00:00:55,810 --> 00:00:57,310 You could copy and paste and delete it. 18 00:00:57,340 --> 00:01:05,920 But again remember we're always in the habit of rewriting code and we want here plot to each different 19 00:01:06,130 --> 00:01:07,160 axis. 20 00:01:07,180 --> 00:01:13,780 Now this is kind of the I guess you could say the tuple way and this is the list index way. 21 00:01:13,840 --> 00:01:14,650 This other option. 22 00:01:15,280 --> 00:01:19,300 Yeah maybe we do that each different index to prevent confusing here. 23 00:01:19,330 --> 00:01:23,430 So we want ax 0 0. 24 00:01:23,500 --> 00:01:26,980 Now can you guess before we even plot anything. 25 00:01:26,980 --> 00:01:28,380 What is this doing. 26 00:01:28,390 --> 00:01:35,380 So if I do this fig ax equals plot dot subplots and rows equals two and Coles equals two. 27 00:01:35,380 --> 00:01:39,480 If we were to index into this ax for 0 0. 28 00:01:39,490 --> 00:01:44,740 Can you guess which one of these four because we're creating the same this code here. 29 00:01:45,160 --> 00:01:48,270 And this code here does the same thing except for variable names. 30 00:01:48,310 --> 00:01:55,430 What are we going to plot to if we pass these index coordinates 0 0 rows 0 columns 0. 31 00:01:56,260 --> 00:01:57,690 Well let's see and find out. 32 00:01:59,530 --> 00:02:02,950 No cheeky reveals here unless we've run the code. 33 00:02:03,140 --> 00:02:03,740 There we go. 34 00:02:04,070 --> 00:02:04,630 OK. 35 00:02:04,790 --> 00:02:06,650 So it's just the same as is here. 36 00:02:06,740 --> 00:02:08,750 But then if we go let's do the same thing. 37 00:02:08,780 --> 00:02:16,100 So if we want 0 1 and want to scatter then we're just going to do the same random at random I believe 38 00:02:16,100 --> 00:02:19,610 it was 10 random random wonderful 39 00:02:22,500 --> 00:02:23,420 There we go. 40 00:02:23,430 --> 00:02:26,580 So again these plots are different because it's it's random. 41 00:02:26,580 --> 00:02:27,780 So these scatter plots. 42 00:02:27,780 --> 00:02:31,170 Same thing numbers between 0 and 10 or 1 in 10. 43 00:02:31,230 --> 00:02:34,740 But because we're calling different random ones they're going to appear randomly. 44 00:02:34,740 --> 00:02:38,550 So each time we run this probably have a different different plot. 45 00:02:38,550 --> 00:02:39,120 There we go. 46 00:02:39,360 --> 00:02:44,030 But all this is saying is access row zero and plot on column 1. 47 00:02:44,070 --> 00:02:46,100 So column zero column 1. 48 00:02:46,110 --> 00:02:47,060 There we go. 49 00:02:47,070 --> 00:02:53,430 And so now you can probably guess what's going to happen next if we go 1 and 0 dot bar and we want now 50 00:02:53,450 --> 00:02:54,390 bottom prices. 51 00:02:54,420 --> 00:02:55,920 Beautiful. 52 00:02:55,920 --> 00:02:58,720 All this talk of Nut Butters is making me hungry. 53 00:02:58,860 --> 00:03:01,110 Might have to do that after this nap and prices. 54 00:03:01,110 --> 00:03:04,920 And that's the beautiful thing about owning a nut butter store right is that you can just eat your own 55 00:03:04,920 --> 00:03:06,960 supply not too much. 56 00:03:07,050 --> 00:03:08,890 Because we need to still make profits. 57 00:03:08,940 --> 00:03:10,610 We're gonna do two at the same time here. 58 00:03:10,650 --> 00:03:13,640 His brand in. 59 00:03:14,040 --> 00:03:15,360 That's what I want. 60 00:03:15,360 --> 00:03:15,960 There we go. 61 00:03:16,170 --> 00:03:20,460 But you see what we've done we've forgotten a semicolon there and now there we go. 62 00:03:20,460 --> 00:03:25,500 So we've created the same plot here same subplot using two different types. 63 00:03:25,500 --> 00:03:30,840 I personally prefer option one because a bit more readable for me if I look at something like this you 64 00:03:30,840 --> 00:03:37,410 may prefer option to list indexing can be helpful in some scenarios it's all about just trying it out 65 00:03:37,410 --> 00:03:42,320 and see how you go but I think I think we'll stick with option one for the rest of that pop lib section. 66 00:03:42,610 --> 00:03:50,550 So that's just to show the two different ways of doing subplots with the same command here BLT dot subplots 67 00:03:52,010 --> 00:03:52,970 All right. 68 00:03:53,060 --> 00:03:59,090 So now we've seen different ways of plotting directly from num pi arrays but it's most likely most of 69 00:03:59,090 --> 00:04:02,270 your planning will probably take place from a panda's data frame. 70 00:04:02,810 --> 00:04:07,310 So we've seen painter's data frames in the past and we know that they're built on top of num pie arrays 71 00:04:07,600 --> 00:04:11,120 and we know that map plot lib plots are built on num pi arrays. 72 00:04:11,120 --> 00:04:14,720 So let's see how this synergy works we'll see in the next video.