All righty.
So we've seen create quite a complex plot.
But in terms of customization we've kind of glazed over these set parameters and title and X label and
Y label or not.
So what we're gonna do now is look at customization of plots a little bit more in-depth.
And by the end of this video perhaps the next video we're going to replicate or transform this plot
into something which looks exactly like the one we've got here.
So the data's still the same but you can kind of see that there's a different style in terms of color
line and just the tax is a little bit different the font.
The axes are a little bit different.
So let's get into it a is what we're going to do first is have a look at some different styles of matte
plot lib.
So the beautiful thing about matte plot lib is that again one of its other customizable parameters is
this style of plot that you're using.
So if the default one which is what we're kind of using now doesn't quite look how you want it to look.
You can try other different styles so let's go down here and make a little section customizing matte
plot lib plots and getting stylish.
Yeah that's what we're gonna do.
We in stylish see the different styles available.
Now what this is going to do is if we call BLT dot style dot available it's going to tell us what kind
of styles map plot Lee has available to us right now by default by just importing that plot layer right
at the top.
We're using the default style but as you can see there's about 20 other styles that you can use.
So let's try out a few of these but first we remind ourselves of what the default style looks like.
That way we can compare and see which one we like best because I've tried a few of these and I kind
of know which ones I like.
But again it'll come down to personal preference of what kind of style you want to use so this is the
default style.
Plotting the car sales data frame that we've seen a few times now.
So car sales don't head the same car sales.
Well car sales data frame report the plus column got a beautiful line graph.
Now that's that's pretty good on its own.
So let's have a look.
Maybe we want to use peyote dot style to use and I'm gonna choose the seaborne white grid.
Let's see what that looks like we'll type that in seaborne White red.
Wonderful.
So that's going to update Matt Gottlieb's style internally.
So if we call the same plot that we did before.
Price dot plot put a semicolon at the end.
So it looks a bit different.
Now we've got some grid lines here.
We've got a little bit of a gap here maybe the Axis his limit is a bit higher for the y axis but generally
quite the same as the default map plot lib style now.
And you might think that the map bot lib default style is perfect for unis and that's okay.
We've gone through these different styles right because I want you to understand just how customizable
these plots are.
Let's try another plot dot style dot use.
And this time we might just use the default save on.
So if we go up here Seabourn on its own now Seabourn is another plodding library that's built off map
plot lib.
And now we're going to a car sales price.
Wonderful.
So now kind of a little bit different.
So this is what.
Great.
So we've got a white background that kind of makes sense but the default Seabourn style kind of has
this gray background.
But again we're still plotting the exact same data just mixing up the style mixing up the colors.
Why don't we try another kind of plot.
Where did car sales help launch now that the style is set to Seabourn.
How about we check the odometer K M and then let's go.
Domino versus price.
We've seen this plot somewhere before.
Kind.
Eagles will make it a scatter plot.
There we go.
So a little bit different to the original scatter plot that we've seen before.
This one maybe look a bit better to you.
I personally prefer the Seabourn style so I might run this line of code when I start a new notebook.
So run it right at the top under my map plot maybe imports just to make sure all my plots are in the
Seabourn style so we'll save that there.
That's not a good habit to get into is just hitting command or control s every so often with your notebooks
and we might use one more plot just for good luck plot style this time we're going to use G.G. plot
which is up here G.G. plot is a different kind of style.
And so do the price graph again price.
The plot.
There you go.
So now we got a bit of a different maybe a creamy Gray I don't know how you would describe that color
but the line is definitely changed to red as you can see seaborne kind of comes with some axis titles
by default whereas these don't have them.
OK.
Now these are some sweet looking plot.
And now we're seeing that a change up the style.
How about the titles the legend and the Axis scenes like this one doesn't have any.
It just has numbers on both axes if a plot is worth a thousand words adding a few more can't hurt right.
So let's do that.
We'll go or create some dummy data create some data x equals.
We've seen this before.
Number pi Rand in we'll go 10 for there we go.
We've got an array there.
Wonderful.
Now we'll put that into a data frame.
We've created a data frame like this before but we're just going to practice practice practice reworking
some of the things we've already done.
That way they start to sink into memory a bit more.
See these wonderful.
Now this should give us a data frame.
Four columns 10 rows of some random numbers.
Beautiful.
And now we're going to create a simple plot.
Now this we're going to use a pipeline API because we want to just create a plot quickly.
If you wanted to create something more in-depth like we've done here where is there you would probably
use the object orientated API.
But because we're doing some quick and dirty plots at the moment we'll just use the plot straight from
the pan this data frame with the pie plot API so kind equals bar and then we going to look at the type
of x beautiful.
So this is a bar graph that we've built just off this data frame here we've got some negative and positive
values different colors for the different columns.
That all makes sense.
And now we're going to customize our plot with this set method.
So we've got X.
We'll rewrite it X so we can see it all in one cell.
After plot kind equals bar.
Wonderful.
And now we want to add some labels and a title.
So we want X dot set and we've got title.
So as you can probably guess this is gonna set the title random bar graph from data frame
wonderful I've spelt graph terribly.
That's right.
There we go.
And then within this set set has a few parameters here.
So we go shift tab there we go shift keyword args.
So this is probably another one you probably want to look into the documentation to start to figure
out all the different kinds of customizations you can add to it.
But we're just gonna go through the main ones which are Title X label and Y label deprived the bare
minimum you'd want on any plot or figure that you create right.
You want to know what's on the x axis and you want to know what's on the y axis rather than just having
numbers in row number random number.
Simple titles and then we'll make the legend visible.
Now this one is kind of confusing because the legend already is visible but if it wasn't visible some
plots do have a legend already built in.
So you can use this X dot legend dot set it visible and then sets that visible to true which won't really
change ours because it's already visible.
But let's see what happens.
What do we got here.
Axis plot has no property title.
Oh another typo.
There we go.
Wonderful.
So now we've got the same exact same plot as up here but now we've just used a set method to add in
an axis label on the Y and the X and a title.
So that's starting to look a lot more communicative right there right.
Now what if the style we're using doesn't quite suit the plot.
We're trying to make.
So that's what I'll probably look into the next video will change around the style within a set style.
So that sounds a little confusing.
Don't worry we'll go through it in the next video but in the meantime try out creating some of your
own plots using plot style and use and pick one.
Anyone from this list and you start to get a feel for what the different styles look like.
My personal favorite is probably C bone or bond white greed seaborne generally just has some great styles
down here.
All right let's take a little break write some custom code and I'll see you shortly.