Hello everyone and welcome to Part 3 of the map plot lib lecture series.
In this final part we're going to talk about setting colors line with line types and really customizing
the options of hire plot actually looks.
Let's go ahead and jump to the Chippering notebook to get started.
OK here we are at the Jupiter notebook.
Let's go ahead and talk about setting colors with that plot live.
So I'm going to go ahead and just say fig equals VLT figure and then I'm going to go and add a set of
Access's figure x is equal to Fig.
Add underscore axes and I will set this at 0 0 1 1 and then wups and then off of that sort of axes I
to say X stop plot and do X come a Y.
And this is a reference to the same x and y that we've been working with.
So if I go in and plot that I get something that looks like this.
Now I can edit this color of the plot by putting in the color parameter and the color première can actually
take multiple arguments it can take in arguments such as common color strings like blue or let's go
and put in orange or you can see when an orange line out or green and you get a green line.
So very basic color names.
It can actually except as a string if you want to start getting more detailed.
You can actually put in RGV hex codes so I can put in hash tag and then some RG be hex code such as
go Gaudens copy this from the notebook f f 8 C 0 0.
Whoops it's.
And that gets you in more custom color.
So you can go ahead and google search for RSGB X code maker or Creator and you should have plenty of
tools available freely online.
We're actually coming up with these are G-B hex codes in case you want to make a very custom color for
very basic colors basically kind of Crayola colors such as purple.
You should be able to easily plot them and just passing the string.
OK so that's the basics of colors.
Now let's talk about line with and line style if you want to edit the line with.
You can actually just pass in line with as an arguments and just put in a number.
So for instance if we put in one that is the essentially default line with we want to go double the
default and say line with is equal to 2.
And that will double the width we can continue doing this.
If I want a very thick line just like with equals 20 That's 20 times the thickness of the default line
.
Or if you want a very thin line such as have the default thickness 0.5 you can start getting thinner
and thinner.
Another very useful tip as far as line with and line visibility is the alpha arguments so go ahead and
set my line equal to line with three and you can specify the alpha argument which allows you to basically
control how transparent the line is.
So I can say Alpha is equal to 0.5.
And if I run that now I can see we actually have a little bit more transparency on this line.
So you can combine color line with an alpha in order to get the exact appearance that you want.
One last thing to note here is for short hand you actually don't have to type in line with completely
.
You can just type in LW and it will still work just fine.
OK.
So we're talking about line with color and Alpha and I'm going to remove the alpha call.
Now let's talk about line style so I can type in line style and line style there's quite a few options
and they're listed in your note book that it basically just defines the style of the line such as a
dashed line or a dotted line.
For instance if a person two dashes I end up getting a dashed line and just passing this in as a string
or I pass and a dash and then a period I get the sort of dashed line.
So dash point dash points and then there's a couple of more options pitches.
Colon which gets me these smaller dashes here and you can check out the Jupiter note book for this lecture
to see what other options you have.
And then you can do steps hour.
I rarely use those.
Most often I'll just either do a dash line or if you just put in one dash it's just a solid line.
OK.
And just like with line with you actually don't need to type in line style.
You just put ls and it will end up working just the same.
OK.
So we talked about line with and line style.
Now let's talk about markers.
So markers are going to be used when you have just a few data points.
For instance if we take a look at X as a reminder of what it is we can see the x is just an array of
go ahead and check the length x of 11 points.
Let's say actually we wanted to mark were those 11 points occur on this plot.
Well I can specify marker as a new arguments should be a comma and then I can pass in a string.
So there's lots of possible marker symbols and they're listed in your note book.
But the most basic one in common one is just this lowercase O as a string.
And there you can begin to see some dots that basically mark out each points on X versus Y here and
there's a wide variety of markers available to you.
They're all listed in the note book.
But just to show you a couple who can do things such as plus signs which don't show up too well here
you can do things such as Little stars like Asterix symbols.
You can do things such as passing in these number codes I'm going to make the line with a little thinner
so you can actually see these markers here.
So we wanted to make these markers bigger.
Well you may have guessed that marker size isn't arguments so you can go ahead and specify marker size
and essentially just one is the very small size.
And then if you want to make it quite a bit larger you can say 10.
And here we can begin to see these kind of triangles being in the form.
So let's go and say just huge markers at 20 and then we can specify markers type ear 2.
You can say plus we get these plusses here etc. so all these options are listed in the documentation
.
And more importantly in your Jupiter note book says there's so many different types of strings you can
pass in as marker for marker codes.
And if you really want to customize your markers for instance go ahead and put this back to lowercase
Oh so we get these points here to change this line with back to one.
There's actually quite a few options as far as specifying what the marker looks like.
You can specify the marker face color the marker edge with and the marker edge color.
So first it's going to go out and add these arguments in.
So just press comma enter for a new line.
And I'm going to go out and say Mark face color
and you can specify the marker face color.
So they'll be the color inside of that circle.
Let's go ahead and make it yellow and run this.
And that changed the marker face color.
Let's say I want to change the marker edge with I go and edit that as well.
Make that a little thicker such as three that makes a little thicker and let's say actually want to
specify the color of the marker edge.
I can specify a marker edge color.
Now let's go to make that green.
All right.
So you can see there's a lot of customize ability here and there's a lot of options if you want to see
a bunch of examples of different options you can go ahead and jump to the Jupiter note book for this
lecture.
I to go ahead and do that now.
It's going to go ahead and click on over and if you see here on the map Cutlip concepts lecture.
Right now we're in the section line marker and line and marker styles.
Here there's basically a figure where we did told by six on the subplots the first figure size and did
a bunch of plots and edited the colors the line with the line styles.
And here's a bunch of examples so you can go ahead and read them out.
And if you're looking for a different possible marker symbols are all here as comments or allied cell
types etc..
So there's a lot of different examples here in kind of copy and paste from or build your own knowledge
off of.
Finally let's talk about control over access perience and plot range.
And if we hop back over to our original notebook over here we can go ahead and show how we can set the
Y limit and the limit.
We're going to make this just a very simple plot again.
Let's go ahead and just make this line with equal to and let's make lifestyle equal some dash line.
OK great.
Let's say I only wanted to show the plot between 0 and 1 on the x axis.
Well to do that just clear access and then say set underscore X Lim and then you pass in a list with
a lower bound an upper bound.
So we'll go from 0 to 1.
And here we can see we've set the lower bound an upper bound of the x axis.
Now let's go ahead and do the same thing for the why limit just clear axes and then say sets underscore
why Lim and as a list you pass an upper bound and lower bounds lower by that zero comma.
Let's make the upper bound.
So just put it at 2.
Now we can see this plot.
And notice as we zoom in the plot looks more and more like a bunch of straight lines connecting points
which makes sense because we don't have as much detail SR's only 11 points as we zoom out.
We see more of a curved line and we can fix that by getting more data points or by zooming out.
All right finally I want to hop back over real quick to the map Partlow concepts lecture and talk about
such special plot types.
There's lots and lots of many specialized plot types you can do with MAP plot lib such as bar plots
histograms and scatterplot.
Most of these plot types were actually going to use in another visualization library called Seaborn
which is much better suited for these sort of statistical plotting methods.
But just to show you that you can do this in my live.
You can perform scatterplot such as this you can perform histograms using that plot live or even the
things such as box plots.
And here are some examples for you.
Now at the very bottom of your Jupiter notebook for this lecture you'll see a bunch of links for further
reading including the project web page that plotted and one link.
I really like is all the way here second to the bottom.
This Lorieau are a really nice link.
It's a map lib tutorial.
Hopefully you actually know quite a bit now by watching these three lectures that we just did.
But what I really like about this link is that it's essentially just a reference code.
So if you want to change colors in line with you can go in and check out this link.
Just look at the figures and it will tell you how to set ticks at tick labels etc..
Moving spines adding legends.
A lot of these points are actually in the other note book for this lecture series called The advance
map plot lib Notebook.
We're not actually going to have a video lecture on those advanced topics for now because we're not
going to use them too often throughout the course.
In fact we're mostly going to be using Seaborn throughout the course.
OK.
Coming up next is a quick overview of the plot plotless exercise and then you'll have a overview of
the solutions for that exercise.
For now go ahead and hold off on these special plot types and wait till we learn about using Seaborn
which is going to be much better equipped for these sort of beautiful statistical plots.
Okay.
Thanks everyone and I'll see you at the next lecture.