Okay.
Welcome back.
So in the last video we said that there were two options for subplots but the beautiful thing is that
we can use the same command we've been using for single plots to create subplots.
So we've seen a preview of option 1.
Let's do option 2.
Just because if you come across these I want you to be aware of it.
Option 2 in your research you might see both of these come up.
So that's why we're checking out two different ways do you have to use two different ways.
No you don't.
We'll probably stick to using option one throughout the rest of the series but this is just so you know
what's going on.
So go figure and ax while this syntax looks different already.
This is just like we're making one but rest assured we are creating subplots and rows and Coles equals
two.
And then we want fig size we're just replicating what's here.
You could copy and paste and delete it.
But again remember we're always in the habit of rewriting code and we want here plot to each different
axis.
Now this is kind of the I guess you could say the tuple way and this is the list index way.
This other option.
Yeah maybe we do that each different index to prevent confusing here.
So we want ax 0 0.
Now can you guess before we even plot anything.
What is this doing.
So if I do this fig ax equals plot dot subplots and rows equals two and Coles equals two.
If we were to index into this ax for 0 0.
Can you guess which one of these four because we're creating the same this code here.
And this code here does the same thing except for variable names.
What are we going to plot to if we pass these index coordinates 0 0 rows 0 columns 0.
Well let's see and find out.
No cheeky reveals here unless we've run the code.
There we go.
OK.
So it's just the same as is here.
But then if we go let's do the same thing.
So if we want 0 1 and want to scatter then we're just going to do the same random at random I believe
it was 10 random random wonderful
There we go.
So again these plots are different because it's it's random.
So these scatter plots.
Same thing numbers between 0 and 10 or 1 in 10.
But because we're calling different random ones they're going to appear randomly.
So each time we run this probably have a different different plot.
There we go.
But all this is saying is access row zero and plot on column 1.
So column zero column 1.
There we go.
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
bottom prices.
Beautiful.
All this talk of Nut Butters is making me hungry.
Might have to do that after this nap and prices.
And that's the beautiful thing about owning a nut butter store right is that you can just eat your own
supply not too much.
Because we need to still make profits.
We're gonna do two at the same time here.
His brand in.
That's what I want.
There we go.
But you see what we've done we've forgotten a semicolon there and now there we go.
So we've created the same plot here same subplot using two different types.
I personally prefer option one because a bit more readable for me if I look at something like this you
may prefer option to list indexing can be helpful in some scenarios it's all about just trying it out
and see how you go but I think I think we'll stick with option one for the rest of that pop lib section.
So that's just to show the two different ways of doing subplots with the same command here BLT dot subplots
All right.
So now we've seen different ways of plotting directly from num pi arrays but it's most likely most of
your planning will probably take place from a panda's data frame.
So we've seen painter's data frames in the past and we know that they're built on top of num pie arrays
and we know that map plot lib plots are built on num pi arrays.
So let's see how this synergy works we'll see in the next video.