‫Alrighty.
‫So we've seen how to 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 going to 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 is still the same, but you can kind of see that there's a different style in terms of color
‫line and just the text is a little bit different.
‫The font, the axes are a little bit different.
‫So let's get into it a.
‫So what we're going to do first is have a look at some different styles of map plot lib.
‫So the beautiful thing about map plot lib is that again, one of its other customizable parameters is
‫the 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.
‫Make a little section customizing map plot, lib plot and getting stylish.
‫Yeah, that's what we're going to do.
‫We're getting stylish.
‫See the different styles available.
‫Now what this is going to do is if we call PLT style dot available, it's going to tell us what kind
‫of styles Matt Plot Lib has available to us right now by default, by just importing that plot lib 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, 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 a default style.
‫We're plotting the car sales data frame that we've seen a few times now.
‫So car sales don't head this out.
‫Car sales, car sales data frame.
‫We plot the price column.
‫I've got a beautiful line graph there.
‫Now that's that's pretty good on its own.
‫So let's have a look maybe we want to use PLT style don't use and I'm going to choose the seaborne white
‫grid.
‫Let's see what that looks like.
‫We'll talk that in Seabourn White Grid.
‫Wonderful.
‫So that's going to update map plot libs style internally.
‫So if we call the same plot that we did before, price dot plot, put a semicolon at the end, see how
‫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 access limit is a bit higher for the Y axis.
‫But generally quite the same as the default map plot lib style.
‫Now again, you might think that the map plot lib default style is perfect for your needs, and that's
‫okay.
‫We're going through these different styles, right?
‫Because I want you to understand just how customizable these plots are.
‫Let's try another plot style use, and this time we might just use the default.
‫Seabourn So if we go up here.
‫Seaborne on its own.
‫Now Seaborne is another plodding library that's built off map plot lib.
‫And now we're going to car sales price.
‫Plot.
‫Wonderful.
‫So now kind of a little bit different.
‫So this is white grid.
‫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 would be car sales dot plot.
‫Now that the style is set to Seabourn.
‫How about we check the odometer cam and then let's go.
‫Odometer versus price.
‫We've seen this plot somewhere before.
‫Kind equals will make it a scatterplot.
‫There we go.
‫It's a little bit different to the original scatterplot that we've seen before.
‫This one may be look a bit better to you.
‫I personally prefer.
‫The seaborne 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 Libyan ports just to make sure all my plots are in the Seabourn style.
‫So we'll save that there.
‫That's another 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 what are the price graph again?
‫Price dot plot.
‫There we go.
‫So now we've got a bit of a different maybe a creamy grey.
‫I don't know how you would describe that colour, but the line is definitely changed to red.
‫As you can see, Seaborne kind of comes with some access titles by default, whereas these don't have
‫them.
‫Okay.
‫Now, these are some sweet looking plots, and now we've seen how to change up the style.
‫How about the titles?
‫The legend and the axes?
‫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.
‫We'll create some dummy data.
‫Create some data x equals.
‫We've seen this before.
‫Num part dot rand n and we'll go ten for.
‫There we go.
‫We've got an array.
‫They're wonderful.
‫Now we'll put that into a dataframe.
‫We've created a dataframe 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.
‫C d wonderful.
‫Now, this should give us a dataframe.
‫Yep.
‫Four columns, ten rows of some random numbers.
‫Beautiful.
‫And now we're going to create a simple plot.
‫Now this.
‫We're going to use a PI plot 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 it?
‫There.
‫You would probably use an 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 PANDAS data frame with the PY plot API.
‫So cond equals bar.
‫And then we're 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 make
‫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.
‫Plot kind equals bar.
‫Wonderful.
‫And now we want to add some labels and a title.
‫So we want AX to set and we got title.
‫So as you can probably guess, this is going to set the title random bar graph from DataFrame.
‫Wonderful.
‫I've spelt graph terribly.
‫That's all right.
‫There we go.
‫And then within this set, set has a few parameters here.
‫So we go shift tab.
‫Oh, there we go.
‫Shift key 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 going to go through the main ones, which are Title X label and Y label.
‫From 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 at
‫having numbers, their 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 ax dot legend, set visible and then set set 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?
‫Access point 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 access 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 we'll probably look into the next video.
‫We'll change around the style within a set style.
‫So if 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, use and pick one anyone
‫from this list and just start to get a feel for what the different styles look like.
‫My personal favorite is probably Seabourn or Seabourn White Grid.
‫Seabourn generally just has some, some great styles down here.
‫All right, let's take a little break.
‫Write some custom code, and I'll see you shortly.