Data Science & Machine Learning Bootcamp -- Class 3 of 10 -- EDA with Matplotlib & Seaborn | Dr. Junaid Qazi, PhD | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Data Science & Machine Learning Bootcamp -- Class 3 of 10 -- EDA with Matplotlib & Seaborn

teacher avatar Dr. Junaid Qazi, PhD, Data Scientist

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

18 Lessons (3h 53m)
    • 1. Welcome - Class 3

    • 2. Matplotlib Essentials (Part 1) - Basic Plotting & Object Oriented Approach

    • 3. Matplotlib Essentials (Part 2) - Basic Plotting & Object Oriented Approach

    • 4. Matplotlib Essentials (Part 3) - Basic Plotting & Object Oriented Approach

    • 5. Matplotlib Essentials - Exercises Overview

    • 6. Matplotlib Essentials - Exercises Solutions

    • 7. Matplotlib Essentials (Optional) - Advance

    • 8. Seaborn - Introduction & Installation

    • 9. Seaborn - Distribution Plots

    • 10. Seaborn - Categorical Plots (Part 1)

    • 11. Seaborn - Categorical Plots (Part 2)

    • 12. Seaborn - Axis Grids

    • 13. Seaborn - Matrix Plots

    • 14. Seaborn - Regression Plots

    • 15. Seaborn - Controlling Figure Aesthetics

    • 16. Seaborn - Exercises Overview

    • 17. Seaborn - Exercise Solutions

    • 18. What next in class 4?

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

This is class 3 of Data Science and machine Learning Bootcamp.

Reminder: Please use the suggested version of libraries during the course/class. It is recommended to use .yml file to create the environment. You can watch lecture 6 and 7 from Class 1 to set up setup environment for the course. We are working with these versions: matplotlib=2.0.2 and seaborn=0.7.1

If you have already downloaded the Course_Material, you don't need to download again. Otherwise, you can download the Course_Material from the panel on your right, which is only for this class.

Meet Your Teacher

Teacher Profile Image

Dr. Junaid Qazi, PhD

Data Scientist


Dr. Qazi has a solid knowledge of Maths, Statistics that are key to Data Science and Machine Learning. He holds MS in Computer Science and PhD degree.  As a mentor and a researcher scientist, with over 17 years of professional experience, Dr. Qazi has developed a skill set in data cleaning/mining, data analysis & data modelling, project management, teaching & training and career advising while working with academic and industrial giants. Dr. Qazi has also served in academia for several years at the rank of lecturer and assistant professor. During his career, he won several funding awards for his research ideas and published high quality articles in well reputed international journals in collaboration with leading scientists from University of British Columbia, Canada; Uni... See full profile

Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Welcome - Class 3: 2. Matplotlib Essentials (Part 1) - Basic Plotting & Object Oriented Approach: Hi guys. Welcome to the mat plot. Lip Essentials Lecture Match brought Lib is the most popular plotting library for Python, they say. On their rap side, Match brought Lip tries to make easy things easy and hard things possible. Matt Barkley was originally written by John Hunter to visualize electro cartographic data for epilepsy patients during his post doctoral research in neurobiology. He created this library. Replicate Matt Labs, plotting capabilities in Python. If you have ever walked with Matt Lap, Matt brought, lib will feel natural to you later on. This open source library emerged as the most widely used plotting library for python programming language and a core component for scientific python Stack, along with some pie cyp I and I bite on. Along with providing great control on every element in a figure Matt brought, Lib is very easy to get started for simple plots. Matt Plot Live is very customizable in Journal. As for and with just a few lines of court, it generates high quality plots, history, Grams published spectra bar charts, adult charts, scattered plots and much more. The official documentation off Matt Plot Live is provided on its website. This is a great idea to explore Matt plot lip examples and tutorials on its official website. You can follow this link on examples, and you will see a gallery Matt plot a P I and you will see configuring the front family, unique court minus text wash remark and so many other examples. And if you follow the tutorial link, you will find that introductory simple plots in math plot, lip customizable met, plot lib, an image tutorial, user guy and much more so moving forward in this section we've been learned Matt. Plot Libs, Key features, meet examples. Let's get started before we move on. I hope you have already installed this state of the art library. If not, follow these commands. Kanda. Install Matt Plot Lip or Pip install Matt Plot lip to install this library. Let's start with the new Jupiter Notebook file. New notebook Pilot country And here we have a new Jupiter notebook. So I have already installed Matt Block Lib. So the first thing first we need to import Matt Rocket so we will see import mad plot lip dot p lie plot as p lt So we're importing P by plot from Matt bluntly as plt. So this is the regular official way off importing this library. Aspey lt. So let's on this. We're walking in the Jupiter notebook Jupiter, nor, put provides a convenient way off printing the plot within the notebook using Matt plot Lip in line command. This is only for Jupiter notebooks. If you're using an other editor, you will use plt dot show at the end of your plant in command. This will pop up the figure in other window. So because we are working in a Jupiter notebook, we will. Right, Matt clocked. Leave. Think lying. Let's from this cell. So now we have executed this command. So? So we will be able to get the plot within the notebook. So moving forward, we need to walk the data. Let's start with a simple example using to numb pie areas to plot numbers along X and their scares along Why axes? So to do this, we have to import numb pie, asteroid import lump, I S and P. And now we want X equal to N P. Dark. We can use the range here, and we want 10 numbers. So let pass in a lemon here, and, uh, our Why is the square off acts so X square? So this is lower case and left front This cell as we know it's always good to see the data . So let's bring acts. We have 012 up to 10 and let's print or why. So we have 01492 square, three square and sore. Let's add some cells here, so let's start with the basic plotting. So we want a line plot. We have Data X and why? So we can simply call plt dot plot. And if you want shift tab and you can see the document string for this function plot X y. So we need to pass in X and y. So let's passion X Y and see how the result looked like. So here we have the basic plot, which is a line plot. Acts along. X X is why along y axis we want to set its labels. So what we can do? We can call plt dot x label and we see picks access and let's copy this one and we also want why label? So we only need plt dot Why label? And here we have why axis Let's run this and see how the things changes. So here we have X axis y axis. So let's give the title to this plot so we can simply say plt dot tighter and pass in the string Figure X and picks square. Let's run this. So here we have tighter. We have y axis, we have X axis. So remember we said we're using Matt plot lip in line so we don't need to type in the plt dot show. Come on. If you're not using Jupiter Notebook, you need to call plt dog show and run this it will print on the plot using this show. Come on, you notice that even in this Jupiter notebook using plt dot show, you are printing this Applaud. And if you common this plt door true, you will see you're getting out foot because you're getting this red cell as well. So moving forward how to create multiple floors on the same cameras. So we have this canvas and we want to put multiple plots on this canvas. Subplot is a function in Matt, partly, which provides a convenient way of creating multiple plots on the same cameras. So let's call subplot here. Plt. We can call dot sub and you can press tab and this is subplot. So which argument we need in this one we need and rules home and easels. We weren't how many columns we want and then the plot number. So let's pass in one, three, one. So we want one number of floors, three number of columns and one as a plot number. Let's put some data on this canvas as well, so plt dot blocked We want to put X in. Why? And we can see we want red in color. So let's from this end here. So here we have applaud with color red on our selected canvas. Let's copy this one. And we said We want one road, three columns. So what we are going toe print on to This was the plot one. So now we want to select the number two in the second collar. Let's Blart Y was his ex here and say, We want green and let's run this court again. So here we have green and here we have read Let's copy this again and we have, as we know, we said three columns, so we have the third canvas empty so we can see if we can call 3rd 1 here. Now we can plot both X and y and Y and X on the same canvas. So let's pass in X here. Why here? And say we want green with star and see threat with star and let's run this one here. So here we have the first plot X y in red line. Second plot at plot number two, the Green Line and the third plot at Park number three Green stars as ex Illinois and elect stars s Why versus acts we can say we want lying along with the star so we can passing this for lying and say we want this doctored lines off are dotted line so twice of thes symbols . So for dotted lines twice a symbol. So let's run this end. So now we have the red dotted line because of this symbol. So we have the green dotted line and in this third part we have the star and line. We have the star and line If you want, we can passing No, here we have star and dotted line. So one thing you notice that thes axes are kind of overlapping. This is very easy to fix what we need to do. We need to call plt dot tight. Hopefully, and with this simple one line, we're going to fix this issue. And here we have. They have some space. They are kind of not overlapping anymore. So it looks like the lecture is getting longer. Now let's split it here and see in the next part of the same lecture. Good luck. 3. Matplotlib Essentials (Part 2) - Basic Plotting & Object Oriented Approach: So welcome back, guys. So let's talk about Matt Plot Libs. Object oriented approach. In the above plots, we have seen the basic plotting, which is very quick and easy to generate plots. However, it is recommended to use object oriented approach for more control and customization off our plots. Let's break down and learned the formal introduction off Matt Plot Libs. Object oriented FBI for plotting the date. The idea behind object oriented approach is create a figure object and then call methods or attributes from that object. This elegant approach is greatly helpful when we're dealing with the canvas that has multiple plots on it. To start with, let's create a figure instance, say fig one, and add access on that figure. So the first step is creating figure object, which is an empty canvas. So let's start with creating a figure object Big one equal to plt dot figure, so this will create the figure object. The second step is add access. So let's add access access equal to we grab this figure one. A big one. Corn, uh, axes on this fig want on this object and passing the list, which is left bottom Richt and height. 0.1 0.1 0.9 0.9 So, 0.1 left 0.1. Watch him Perfect and Hunt and the third step is plot the data. Let's put some data on this axis, so axes dot plot the same Command x. And why that front this school and see all these things work. So here we have we have fig one. We added the axis and then plotted the data. Now we can set the labels, Weaken said the title, and we can do lots of other things. Let's set the labels and the title What we do. We Gap Access Call set, X label, Far X label and set under school Y label for Y level and the similarly set Underscore Title to set the title. So exit start, sit. We can press Tab, an ex label. C X exes Start set. Why label and see why Excess start set Tyto and we see title. Let's run this self again. You can see how this thing small one. So here we have acts. Why and tighter. So let's revise this thing what we did in steps so first thing we created an object which is an empty canvas fig one using plt dot figure. Then we added axis on fig one, using fig one dark and access and passed in the list with left bottom, Richt and height. In the next step, we plotted our data. We got access called plot on Axis and passing the data, and after that we again grabbed axes called set X labels on access and so on for Y labels and for tighter. So in the beginning, this court is little more and by clue, complicated. However, the advantage is that we have now food control off where the plot axis are placed. Then we can add easily more than one. X is in the figure. Let's learn how to create an inset plot using object oriented approach so moving forward, that's and fuel cells for us. And let's get and other empty canvas say fig to equal to P l T dog figure. And the second step is access. Let's call it X s main because we want insect. So we call it access, main and access inset. What we did fig two and call at axes. And then we passed in the list that's passing the same list 0.1 21 29 0.9. Now we want insects, So Axis insert. Let's call it access. Underscore insect and fig two dot head access and pass in a list. Let's see, that's pass in 0.3 0.5 0.3 did a point for you can play with these numbers later on. You can change SE point to 2.4 point 52.6 and some more and see how the things move on. I'm just using these numbers because with these numbers, we can put the inside at very reasonable place in deplored. So you can play with these numbers and see how things move on and how the insect moves by changing this number and how the main plot moves. And what are the effects on me implored by changing these numbers? So let's pull want off. The next step is we want data on the mean and we want data on the inside. What we need to do. Taxis. I mean, let's grab the mean one first and called plot on that one and say we want X and Y. Let's put some color on this one as. And so we want the blue color plot in our mail. Let's grab, insert no and plot the data. That's it. We want why and act this time and let's everyone color right here. Let's run this. So here we have. We have our main plot and we have our inside. We can set the titles on these plots on the main one and insect weaken sect labels. We can do all kind of things. Let's take the main one first and axes underscore mean and call set X label and see this is me. Next, copy this form, paste it here and said, This is mean Why and changes to why this is the only change we need here. Let's copy once again and set tighter and save mean tighter. That's underscored for us. So now we have main title mean by Mean X. Let's copy these three lines and pierce to tear and instead of mean insert here. So we're working with insect now, so this is our insect in sit, Let's run this score and here we have. So now we have X main Vie Main main title. Insert title instead. Why Inter Tax and the data on main and instead, so you see how easy it is to walk with these two plots. Using object oriented approach discord is once again a little more, but you have more control on the plot, both on insect and email. Once again, if you want to revise what we did recreated an object, which was empty, canvas called it Fig two used and reused plt dot figure. To create these cameras, we added mean and inset axes and passed in the list for their left, bottom width and height. Then we grabbed access mean and access in, sit and plotted data on both campuses. Then we played with the labels and titles for Maine and Far Insect. So moving forward how to create a figure and a set of subplots. Using object oriented approach Met probably provides a built in function subplots, so plt dot sub plots. If we check the docks string, we can press shift tab. Be passing number off rose number of columns. If we want we can share. XX is here y axes and couple of other arguments, so subplots create a figure and set for subplots. This is a very convenient way to create layout for subplots, including the enclosing figure object in a single cell. Let's start with a very simple example. So what we do instead of figure now we need to call subplot. Let's do Topol unpacking to grab fig and access. So fig access Equal toe plt not subplot. So let's Sunday cell and see what we have here we have. So we have a canvas here, so let's pass in. Number of columns and number off rules now. So in rules that say we want to and called equal to two Let's run this thing now And here we have two rows and two columns. Once again, the ah numbers are overlapping. We can call plt dot It's very easy to fix tight Lee out and see Now we don't have these numbers overlapping. So in this case, we're not shading axes. They all have the individual axis. We can share the axis ass well because by default, if you check shit axe and shit, why our falls? Let's called the them and paste them here and set them true and true. Let's run this cell here So now we are sharing accent Why access for all these floors. So here we have. Why everywhere acts and we don't have anything in between these plots. So let's plot some data now. Once again, let's say fig access to get a new one plt dot subplots and then grab axes the plot and put some data on X. Why? Let's run this thing. So here we have. We have our data long back. Sex is in the long Why axes? We have 0 to 10 and 0 200 so we can change the color c R. So we have red color. We can simply set the axis, which is again very simple axes dot said X Level and exes DOT said, while able and ah, we can pass in exes dot sit title and we can say title applicants E X. Here we can see why. Here, Let's run this. So here we have X y and tighter. Let's get to empty canvases. One is fig one and one is fixed, too. Do some stuff. So what we want, Let's had some cells first. Fig one X is one once again to pull unpacking plt dot subplots and the passing two and one mean this is our end bruise and calls, and our 2nd 1 is Fig two. Let's see access to and we want one and two. So in the first run we want to rose and one column in the second canvas. We want one droll and two columns. Let's on this cell So something went wrong. It should be end. Ross and Andrawes. Let's see. So here we have. We have from the 1st 1 line we have to rose. And from the 2nd 1 we have two columns and one drawer. So one more thing I want to mention access is an L A off axis to plot on. Like this. Axis one is an array of faxes, and this access to is also an area off axis. So, like axes, one can be indexed and access to can be indexed. So let's check its type. If you pass type exits one. And let's take the type off X is too. So here we have axes. One is numb pie nd area and access to is numb by nd area. We can eat right through this axis as their number I away, and we can simply use loop. That's called Farlow Pierre for E X I mean, X is one and we want a x dot plot x. Why? And then we want our figure in the output. So our figure for X is one waas, I think one So what we're doing using far loop and it creating over access run and plotting this data and then printing the figure that's run this self. So here we have fig one, which have two axes, axes, one at zero index and X is one at one in backs. And we get the data on these both of these access so we can say ex dot set next level S X And let's copy this one based you tear taste you again. Set it toe Why said it to tighter? This is why this is tighter and reason So it should be e l once again something. So let's tree. So here we have we have acts. Why entitled X y and tighter. So it's kind of overlapping. Let's calm freak one dot tight. What is that? This time we don't need to call plt. We need to call thick because we have already created a figure object here. This were there. So let's run this thing here. Now we don't have any more overlapping, so we can set color here as well Save the flu. And now we have plots in blue color. So instead of flu, we cant access thes plot one by one as but like X is one index zero this one access one index one this one. Let's work with the fig two and instead of flu Paul Exes to and zero and we plot the data on that axis X y and let's give it color red and run this self we need to fig two aspirin. So Haley half So we have ah, red color data off accent by on the force Can was in fig two. Let's access the 2nd 1 No. So for this one, we need to pass in index one. And let's say we want wire next this time and we want green. Let's run this said so here we have red colored on access to zero and green on access to one. We can set the title and X is 20 and we can call set X label and say This is X. We concocted this one copy again and say we want to set. Why label this one is why we can set Tyto title. Let's copy all these three lines and paste them here and changes to one. So let's run the cell now. So now we have X Y title title X y, and we can call Fig tightly out as well. So this one in our think too tight little So there is no more overlapping. So see how easy it is to customize your plots. One by one, you grab one and walk with that one. You can change title independently. We can change Ah label and so much more. So what we did we grabbed 1st 1 at index zero, put the data on set its label set its title. Then we grabbed at the index one and plot the data, put some titles and then access on that one. And similarly, in this one we used due to put the data and read the title so we can loop through these axes are we can grab independently, so it looks like the lecture is getting longer. Now let's split it here and see in the next part of the same lecture. Good luck 4. Matplotlib Essentials (Part 3) - Basic Plotting & Object Oriented Approach: so welcome back, guys. So unless more one and talk about difficult size aspect ratio and dp i while creating figure object Matt plot Lib allows the aspect ratio dp I and figure size to be specified. Fixed size is actually the victim and height of to figure in inches and D p. I is dots per inch or pixels per inch. So many create figures there fig equal to plt dot figure. And if we shift tap, we see there are lots of perimeters fig size. Dp I face color. We will talk about them later, but at the moment, fixed size and DP I let's copy these two and taste them here. We want a figure size, say 10 and five and live on the DP I 100. So if we don't descend, we have created an object with figure size 10 5 and DP I 100. Let's add some cell to make some more space so similarly, we can pass in these arguments in sup loss as well. Like if we have fig axis equal to plt dot some parts, we get passing big size de critters, everyone 10 into five. So let's put the date on this plot as the exes start plug and letter on this score. So here we have. We have the figure size, which is now 10 to 5 inches. We can save these figures, Astro. So Matt partly provide a range of options to save image as J. Pack. Pdf, PNG GPS and so on. If we want to save this figure, which is fake, we can call big dot save fig and we can pass in the name fig name and we can pass in the extension. Let's say we want P and G, and then we can pass in the DP I asked for. Let's say we want to say with 100 DP I And if we don't this thing, we have saved this image. So if we go back to the Ford Orville in which we're working, we can go and check the figure which is saved now. So let's go back and check. So here we have fig name, dark PNG, so this figure is saved in our working directory. So moving forward decorating the figures is also very important. We have learned that we can add acts, labels y labels and plot tighter using simply axes dot set X label axis dots that via label and access Start said tighter. So let's see, How can we aired religions on our plot? So let's cleared FIG equal to plt dot figure and then access equal to FIG, not dead exes. And we pass in a list Farsi, no working parts and 00 one and one. Let's put some data on the figure axes dot plot, and we want acts and we want X Square. And here we can give label equal to a string X Square and let's copy this one paced again. And instead of square, let's plot Cube and said, The label is cube and run this cell here. So here we have X and X Square and X and X Cube. Now we want religions. We want these labels as legend here. So what we need to do it is again very simple. We need axes and call Legion's So with simple one line taxes dot religion, we're going to get these X square and X Cube as legends toe this plot. So let's on this self. So here we have religions with one single axis dark vision, like so the position of the religion can be specified using an optional keyword argument. Alosi in religion function so we can pass in LoC equal to one. And this one is far right corner. So we have right corner. If we pass in two, this is far left corner. And if we passing three, this is for lower left corner, and if we pass in for this is for lower right corner. So these four of the commonly used location for religions or one for a parade corner. Two for upper left corner, three far lower left corner and four far lower right corner. We can pass in ah loc equal to zero and let match plot live. Decide the optimal location for our religion. So if you pass in zero and see how the matter brought lip, decide So Matt brought. Libby is deciding left upper corner for our religion location. That's trackable color line with lying types, Marcus style and so many other options. There are lots of options available in match plot lip to customize the plot. We will explore few off them, and we will learn more along the way to this course. So the color and other graphical elements can be defined in number off ways like math, lab like syntax, where we have our in courts for red color. And if we want in line with dot we simply passing, uh dot in Haifa and so on. Let's private some examples here, so we will start with FIG again, access equal to plt dot subplots. And let's put the data on access dot plot X X plus one and we want red line the dots. Let's copy this one. Paste it here and now instead of X plus one. Let's pass in Express to We want to separate these two lines, and this is why we're setting off set here and we passing G double heifer. So let's run this cell. We're expecting a red line with darts and a green, a dotted line that's on this cell. So here we have that line with darts and the green dotted line, so moving forward, the appropriate way to use color is with color perimeter so color equal toe, purple color, equal toe blue and we can even pass in. RGB Hack scored as well. There's another optional perimeter L far, which controlled the transparency after line or transparency after color. That's copy this cold here and based it here. No, what we want. We want, let's say every passing color equal to glue and L for equal to 0.5. And for experts to, we want, say, color equal to Let's pass in the hack schooled for purple. And let's copy this one basted here and instead of two. Let's three here and let's pass in called for yellow here. So let's run this cell So we have blue, purple and yellow. This l for equal 2.5 is setting the transparency to the half. Let's check this thing. What if we want one? So here we are getting much lighter line because we're sitting Alfa equal 2.1. What if you want 0.6 or 3.8? So this is much darker, so L for controlled the transparency, picking Passing l for far the other lines as well. Moving forward, we can control the line wit, line style, marker style and lots of other perimeters. Let's try to explore few off them, so once again start with thick access. Equal toe plt dot subplots, fig size. Then it. So I'm repeating the scores again and again so that you memorize And you you know, this intact. So it is going to walk in the future aspirin so access dot plot put the data on, set the color equal to say we want purple and let's set the language there to say four and lying style equal to say we want continous line and let's run this first. So here we have. Let's fit this too the screen. So here we have now this one. We have a lying wit. Four line style, a continous line with purple color. Let's pass in marker here. So here we have marker and that's change the market size. Let's pass in. Say it, Andrea. So the marker is bigger now that's passing 18 just to make it much bigger. So here we have, we have much bigger marker. Now let's said the marker a fierce color and say it is Let's read on this court. So here we have the marker face color. That's it. The this line with Astle wishes marker edge. So Markle edge with Let's set it to four. So we have ticker marker Edgeworth. We can set the color off this marker. Educate as well, so we can pass in marker. But color. Let's set it to right and read on this one. So now we have marker that color is right, so there are lots of other option that we can play with. So moving forward Matt plot lip conveniently allows the control on the axis as well. We can set the X and Y limits using set X limb and said wildly methods. We can automatically get the tight fitted actives range as well. If we pass in tight toe the axis X i s That's private example So fig access Equal toe plt dot subplots Let's passing and paroles equal toe one and calls equal to three and fixed size equal to 10. Then c three. We have one draw and t column so we have We're going to create three plots here. Let's grab the 1st 1 and we know we can grab with in that. So access at index zero plot some data. See X and y and access not set title default. So here it should be zero. Let's copy this one basted here and X is one plot X y axes one set title tight and Let's pass in X is one dot t x i s and passing tight. That's paste record again and grab the index to plot x y. And because because we want to set the limits now for X and y so x two dot said exclaim and say we want to have 1 to 4 surpassing a list with 1 to 4 and now we want to set while in I say we want 0 to 50 here. So the the three plotters in the 1st 1 we are getting default range in the 2nd 1 We're getting tight access in the 3rd 1 We are customizing the axe and my rage So let's run this cold here. So here we have in the first run. This is default in the 2nd 1 This is tight humanity. Much difference between these two at the moment and the 3rd 1 is custom where we're setting why from 0 to 50 and acts from 1 to 4. So moving forward, let's talk about some commonly used plots. It is very common to plot a scatter plot. We can create a scattered part simply by PLT door scatter and every passing did the X and Y Plt Scatter, X and Y we're going to create a scatter plot here. So moving forward, let's talk about the history, Graham, how we can create history Graham using ah, Matt bluntly. So for this purpose, we have to create data for So let's import from Brenda Import sample. So and data equal to sample, we can use range here and passing Oneto 1000 and under. So what this sample is doing sample is selecting 100 numbers from list off 1000 numbers, which has generated by range. So let's run this self and we have data. Let's check. So we have a list of numbers. This chick, it's lend. So here we have. We have 100 numbers from 1 to 1000 numbers and we're getting these numbers using sample. Let's call plt dot hissed now and passing data. So here we have his telegram off our data that we have generated in this court. So finally, let's talk about box plot now. So we need to create data again for the box plot. Definitely a data, and we can use np dot random thought normal and then pass in zero STD and 100 and for S T D range. Want to four? So what STD is we want spread between range from 1 to 4. So we're using list comprehension here to generate the data. So let's run this thing and see how the data looked like. So here we have data. So we have three area that each they have 100 elements, so we can check the leant here. So these at sea areas, And if we pass in zero, we can check 100 elements in zero 100 element in one and Hartnett element in to. So, what we're doing we're using n p dot random dot Normal from zero up to 100 elements with standard deviation using range function in each area. Now, we can use this data to plot the ball explored. So we called plt dot walks plot. Been passing data. Let's avoid this. Lots of tax here, so P lt don't show so we can print using show. So here we have the box plot. We can pass in range of perimeter, and if you want, you can press shift tab to explore more. This is quite long list of permitted that we can pass him to a box block. You may not use all off them, but But during the course, we may explore more on these perimeter that you can pass. So, guys, this was all about Matt plot lip essentials. I hope you enjoyed the lecture and got key concepts on Matt Prototype Essentials. There is another Lord book in the course material, which is in math plot lip folder. This advanced notebook contains some other features in math block clip, and it is good to know, but they're not commonly used. If you want, you can explore and go through this court in the advanced storybook. You can set the custom label alphabet a gamma and so on. Like this one, you can take the log scale, and then you can said the scientific notations and access, number and access label spacing and much more. If you have some X that I'm just go through this advanced notebook and explore Maura about the available features in math, bluntly like we can set this spine color, and you can see how the plot is passing through origin and how to set this kind of scale and much more. So this was all about match plotless essentials. Seeing the next lecture where we will do some exercises in Matt, broadly, good luck 5. Matplotlib Essentials - Exercises Overview: Hi, guys. Welcome to the mad plot. Lip exercises, Lecture. Please follow the instructions while solving the exercises. These are relatively easy tasks. If you are new to Matt plot lit, the task may be tricky. You can always reference to the solution notebook. If you find things complicated, please note the command for plotting figures should go all together in the same cell. Splitting them in multiple cells may not show the results. So let's move one and have a quick overview on the tasks in the first cell were simply creating data access and why to use in the provided tasks we have using numb pie a ridge to generate acts and then multiplying acts by two to get the value for why. And then we're getting square off axe to get value for set. If you're using Jupiter Notebook, let's import Matt plot lib dot people. I applaud as plt and set Matt plot lib in line so that we can see the plot within the Jupiter notebook. So in this cell were just important. Matt Plot clip dot Peter Plaut as plt and then setting match blot lip in line. If you are not using Jupiter notebook. You will use plt dot show in the first task the instructions are given. Use plt dot figure and create a figure object, say fig. Then add and access to the figure canvas left bottom width Height are given 0011 and hint is given use. Add underscore axis function, then plot the data and then Sakti labeled and then set the title and create legions as shown in Deplored So head The plot is shown. You have to reproduce this plot using data what we have created here. So in the next one in sections are create a figure object. Put two axes on the figure at 0011 and 0.10 point 60.2 and 0.2. Plot data Accent by on the main axis Plock Data Accent by on the small axis and set its X limit between 12 And why limit between 05 So replicate the figure to access title legions it sector. So here we have to figure we have to replicate this figure according to these instructions in the 3rd 1 Replicate the output using subplots and for loop. So we have to use subplots and far loop. No, the data is X and y. So we have to recreate these three plots using subplots and for you in the 4th 1 Replicate the output using subplots. So we have to outward these three canvases in the 5th 1 plot X Y X is it and X y on the above empty canvases to replicate the plot given below. So the canvases that we have created in Question four we are going to use those canvases in question five and put the data on those canvases. Not that here the labels are overlapping. And in Question five, the labels are not overlapping, so we have to deal with this layout as well. Question six resize the above floors to figure 34 So the plots in figure five we have to resize them to 3 to 4 question someone replicate, deplored, given below. So in this last question, he's asking for to recreate the plot, which is actually a scatter plot given in the hint. So the data again we're using what we have created at the beginning of this exercise is so I hope these tasks are quite easy for you. and you should be able to solve them before you move onto the solution. Notebook. Still, if you find any difficulty, you can always get help from the Solutions notebook. But keep it in your mind. Matt Plot Lib is a key library for data plotting and did. Applauding or data realization is a key thing to understand the patterns. Relations Andi To dig deep inside to your data, try to solve these questions yourself. If you can't find the enter, consult in orderto see you in the next lecture where we're going to solve these tasks. Good luck. 6. Matplotlib Essentials - Exercises Solutions: Hi guys. Welcome to the Mad Bluntly Exercises solution lecture. I hope you have already dealt with the tasks. Let's solve them in this lecture. So in the very forced we need to create a data. So let's run this cell. And if you are a Jupiter user, we need to import macro tip dot p y plot as plt and set Matt brought lip in line so that we can see the plot within the Jupiter notebook. If you're not using Jupiter Notebook, you have to use pmt dot show. So let's run this cell as well. To import. Matt brought lip and set. Matt brought tip in line. So in the first task he's asking for, use plt dot figure and create a figure object. Say figure. Let's create a figure opted fig equal to plt dog figure and then at an access to the figure canvas, which is fake and the left bottom width and height are given 0011 hint is used ad underscore axes, so access equal to fick dot So we have to add access to difficult canvas. So we're calling figure now, which is fig fig dot uh access and passing this list here. So let's run these two lines. So here we have. So we have our canvas with left bottom victor and height as 0011 So the next is plot the Data X and Y owned the Axis. Let's plot the data access dot plot ex and why? And let's run this again and see So this output looks like similar to what he's asking for . We need to add labels now hacks label y liable and plot title, and we need to add religion as well. So let's add labels now. Exes dot set X We can shift tab and auto Complete X label, which is X liver. Copy this one. Peace to you too. That's based it again so that we can set title as well. So this is why labour and let's changes to tighter and plot tighter. So what we're doing, we're setting X label as X label. Why level as why level and title s plot title that's on this court here. So now we have X label y label plot tighter, so X label y label plot tighter. Notice that the color of this line is going so our color is blue. Let's pass in G here. So we're setting deplored with G as green color. So here we have the green color and other thing Now, which is legend. So create Litton's as shown in Deplored We Can Clear Religion. Let's breast shift tab for axes dot floored and look at the documents string if we go down . So a long documentation. So here we have label lying one or labour lying to so we can pass in label whatever the label he's asking for. So let's pass in label here. And our level is why equal to X standard, too. And another thing notice. If you go to the output we see the label is appearing on the bottom right corner. If you remember from your lecture, let's have a quick look on the iPhone. Access dot legend loc. One is upper right L l C two upper left, and we want lower. Right. So loc equal to four. And if we want the mat plot lip to decide, we need to pass in l zero. But in this case, it's bottom right? Are lower, right? We need to pass an elbow C four. So that's copy this one and simply paste it here. So our relation location is loc four, which is the bottom right corner. So let's on the cell now. Here we have replicated the figure. Look at that one. Everything is same. Let's go through. Once again, we're creating a figure object using plt dot figure. Then we're adding axis hair and we're passing the left bottom victor and height. And then we are plotting the data, setting the label and giving the color as green. Then we are setting X label while able title. And then we're passing the location religion as requested. So let's move on to the next one. In second, task instructions are create a figure object. So let's create a figure object fig equal to plt dot figure. Now, this is what we're creating a figure object. Max is put two axes Now, instead of one access we need to put to access and the lists for access one and two are given, So X is one equal to fake dog and axis and passing this list here, let's copy this one based detail changes to access to and person this second list. But this one So now we have access one and access to. Let's run this court and see how it looks like. So here we have. We have main axis and an insect axis. The next is plot data X Zet on being axis and plotted our exit on small axes. Let's finish. Thies, too forced taxes one dot plopped ex and said, Let's copy this form and X is too plot X inset. Let's run this cell here now So here we have. We have data on main axes and we have data on the inset axes. But he's asking for plot data, exit on the small access and set its limit ex limit between one and two. And why limit between zero and five? So we have to set X and Y Limon for the small axes, which is access to so axes to dot said. We know we can set limit using excellent and whiling, and we passing the to pull, which is 12 and 054 x 12 Let's copy this work Peace to tear, said Wiley, which is 05 Let's run this court again, and here we have 1.2 to 1.5 and 2.2 and for why, 0.2 point five and five. The Mexes replicate the figure toe access title and legions. Let's see what he's asking for in the figure. So in the mainland he's asking for Set the axe label as Axe main. Why mean for Why Label Than title and we need to set the title for Inset Aspell and we need to set religion for me. Let's school for these things. So in the mean one, let's sit access dot said X. We can press DAP and until complete and this is X mean. Let's copy this one basted here basted again, I said, Well, why labour and tighter This title is title mean and this one is next mean. And why me? And for Insect, let's copy these three Pierce Street here X is too to to and this honest insect insert why inset and Tyto insert, And this one is one one in one. So what we're doing here were plotting the data we're setting the label acts for me label y for me entitled for me. Then we applauding the data on inside, setting its acts and wild label and title. Let's on this corner, so it looks like similar to what we have. Ah, in the output. It looks like we're producing the same plot now, but we can see we need to change the colors. We need to set religion as well. So let's said religion here so we can pass in label equal to what is this? Why main equal toe X mean square? Why, I mean equal toe X man square. And once again the location is bottom right corner. So it's again loc four. So axes one dot reacher Hello. See equal to four and one thing is left. We need to set the color so main color is red and the insect color is blue so we can pass in hair for her it and in the insect B for blue. So I hope we're done with what he's asking for. We have said the color we have set the label, which is legend hair loss. Before we have set X label. Why label titles and guess it And we have said everything required for the insect Aspell and we have said X and y limits for insect as well. Let's on this court. So here we have. We have produced the same plot in this figure. Now moving forward to the next one. Replicate the output using subplots and far loop. Here we have to use the subplot and we know we can use. Applaud what this in Tex waas Fake access equal to p. Lt dot subplots and we need to pass in Krul's Homa Needles Wonderful and columns 1 to 3 columns and called Equal toe three. So let's run this thing only here we have. So we have three columns. 123 Then one draw. We know we can index on this axis 01 and two and for index, we can use the for loop so far e x in taxes. What we want to do We want to plot x dot plot X Why? And let's run this court here. So here we have We have the similar plots, but one thing the levels are overlapping. We know we have another option here, which is fig dot Fight the old So this type layout is going to solve this problem. Let's from this cell again. So here we have the same output. Now, in the 4th 1 replicate the output using subplot once again the same thing. What is in question? Three, but in question, for instead off three columns, he's asking about three rows. Let's copy the cord from Question three and Peace you'd here and instead of rules, we pass it and rows equal to three and then called equal to once. Let's run this cell here. So here we have the same output. Kristen Fyfe plot, X y Axis said, and X Y on above empty canvas is so we have these canvases. Let's plot the data on those campuses. Now we know we can index these canvases, so index access zero X is one and access to Let's grab them one by one Exes. Zero. Call deplored and put the Data X And why that copy and paste them so X is one and excess to this is accented, and the 3rd 1 is again X and y. So let's end this. So we have to call fig as well. Let's from this delegate. So here we have three candidacies. Let's adjust the other parameters now Color equal to clue. Langley. Three lines tied, dotted for the 2nd 1 Hello equal to read. Langley three and line style is we in passing its continous line. And for the 3rd 1 Hello is green lined with three and the lines time again. It's a continous line, so let's run this elegant. So here we have the same figure now, so you may notice this lighter blue color at the bottom. So we need to read on this empty canvas fast to get rid of this thing. And if we learned this again, so we're getting the same output. Actually, we plotted the data before setting these properties, and it was over writing. So now when we did on this empty canvas we initiated from the beginning and now we have the same on both. So the 6th 1 resized the above plot to figure equal 234 Let's copy this cold here based you tear and copy the line from question for as well, please at the top and no, here we can pass in figure size. I think size equal to three four. Blessed is C. So let's run this cell now. So here we have the adjusted figure now, So if you notice that these three figures are repeated on DA why these a repeated. You see, we have complete chord in one cell. We don't need this fig. Let's hash this one. And if we read on this thing, we have these three figures on Lee. They're not repeated in the above two questions. The court was split it between two cents, and we needed to call the fig toe. Print that out in the last one he is asking for replicate, deplored given below hint. It's scatter plot so the data hits Plotting is Acts and said, Let's pass in Plt Lord, Skater and X said, Let's run this over here. So here we have the similar plot. But one thing notice that these are circles, so the output we want is square. So if we if we breast shift up, we noticed that mark is none by default and none mean circles. So we need to tell here that we want marker equal to square and for square. We need to pass in tests here, So let's read on this thing. So here we have the same plot. So does this was all about the matter Bluntly exercises. I hope now you have a good understanding on Matt brought lip Let's talk about an other very useful and great library, which is Seaborn. So in the coming sections, we're going to learn a C bond Syrian the next lecture. Good luck. 7. Matplotlib Essentials (Optional) - Advance: 8. Seaborn - Introduction & Installation: Hi guys. Welcome to the Seaborne, which is a statistical data realization library in Python. Seaborn is based on Matt Blot Lip. This is why we don't matter bluntly before Siebel, Sieben provides a high level interface for drying attractive statistical graphs in Python on its official That side, it says, if match plot lib tries to make easy things easy and heart things possible, Seaborn tries to make event defined. Set off Hartings Easy to so a brief introduction to the ideas behind Seaborn is provided on its official website. In the introductory notes section, you can go to this link and explore more on its introduction. So see, Bones Website is a great source with well documented examples in its calorie, which gives a sense for what one can do with Seaborn like Alim Plaut bar plot kiddy plot. And we would learn all these plots in becoming sections. So it is very well documented. So kind of plot that Sieben can help to make is explained its tutorial. Whereas a P a reference provides authoritative documentation on the options offered by each function and class, you can explore more using this link and see how the tutorials are given. You can explore these tutorials one by one like history Graham and step by step plotting. And if you want, you can explore AP a reference using the link provided in the notebook. So here we have the a p a reference vested grade factor Port El employed. If you click on this, l implored you get the details on l implored and a well documented section on l implored so to you. See bone, we have to install Siebel for any corner users. The best way to get see bone is where corner So corner install see bone type this on terminal and for others were not using an a corner. People installed Cibo So in this section we will learn range of plots and data realization options available in a P I reference that includes distribution plots, categorical plot access grips that's explodes, the Grecian plots and much more. We will also cover style and color to control figure s statics in Seaborn. Please note the order off. The lectures may be different and depends upon what is required at which state. You can follow the links and explore mawr on these topics on the sea bones. Official documentation. So see you in the next lecture with installed. See bone. Good luck 9. Seaborn - Distribution Plots: Hi, guys. Welcome back to the sea Born. Let's start with C bonds distribution plots when dealing with a set off data. Often the first thing we want to do is to get a sense for how the variables are distributed . In this lecture. We've been learned some useful plotting options that allow us to visualize the distribution off a data set. These distribution plots include this plot joint plot, Pierre plot rug plot K A T E plot, and so on. Simone comes with built in data sets that can be loaded using a function Lord data set and the name off The data said reveal use various building data sets for learning purpose in the sea bone section. Let's start with the new trumpeter nor put Goto file new notebook fight and three and start walking it. Seaborn, I hope you have already installed. See bone library. The first thing we need to do we need to import Cibo the official and most common way to import. See Bone library is as S and s. So import Seaborn s s and s. Let's run this cell and we want our out foot within this Jupiter, nor booklets that match brought live in line as for so here we have. So let's explore the list of data set which are available within See bone. So what we can do We can call s and s dot Get it just said and press tab toward to complete and run this court. Don't worry about this user warning. So we have a list After it. I said attention brain natural car crashes, flights and so on. Let's use tips in this section. So let's add fuel cells forced and dips equal to sms dot We can Lord Adidas at using s and S start Lord a stab toe auto complete and passing the name, which is tapes. Let's from this one. So we have loaded the data said tips into tips. Let's get a concise summary off over data set now, and we know we can use in four to get the concise summary off our data set. So tips dart in four. If we don't disserve here we have our data set have 244 entries and seven columns. And let's check the had enough overdue. Doesn't we want to know as much as possible about our day does it So tip Stop! Heard we know if we don't pass anything to hurt, it will display 1st 5 lines or 1st 5 rules in our leaders. Let's run this stuff. So the data set has total bill along with the amount off tick the customer left for the staff along with some other information, whether male or female, smoker or non smoker, daytime and the sides off the party. So let's start with this. Deplored. The most convenient way to take a quick look at a university in distribution in Sieben is the distant plot function. So we can call this floor Weston s dot this plot and let's pass him total bill and grabbed the caller tips total bill and let's from this certain. So here we have a distribution floor along with a fit off kernel density estimate. So this line is a kernel density estimate fit. If you want, you can press shift up to explore mawr on the documentation stream, we can pass in the data here we have passed in total bills. We can set the size off the been we can set 30 40 50 or whatever we want hissed is true. We're getting history. Graham K. The e is true. We're getting a line, which is Katie. So lots of other options as a para meters. We will talk about Katie later on. Let's set this Katie as false anti moment. So let's copy this one. These two tier and care the e equal to fault. Maybe we want to set the being size Astle's of beans sick or 2 50 and let's run this cell again. So now we have 50 bins and there's no Katie lying. So the data suggest that the most of the bills are between 10 and 20. So this Waas little intro on HIST plot Let's talk about another one, which is Joint Florida. We want to do some comparison like how much the customer gave in Tip. Based on the total Bill. Sieben provides a convenient three off plotting by villians or two variables in the data, and in that case, we have to use giant floor the function basically matchup to distribution parts with our choice off what kind of plot we want, and that is what we give in a perimeter. Let's plot wanting first s and s daughter joint Plaut And if we press shift tab so we have to pass an axe. Why? So the kind of scatter which is default You can explore mawr on these kinds that we can use and lots of other perimeters toe walk with like Bethlehem while him and so on. Let's pass in X hair X equal to we want total bill. Let's copy total bill from here that along Why we want to see tip? Because we want to have a comparison between total bill and tip And what is our data? We need to tell the data and data is tips that's passing on Lee these three para meters and around this set. So here we have a joint plot. So what we did, we passed in the data set and tells which columns we want to plot in the joint floor. And the fourth is a scatter plot. So this is essentially just to distribution plots one his hair and the 2nd 1 is here, along with scattered plot. Having tip on why and builds on X X is we can see that most of the tips on less than $4 like here the maximum in tip is somewhere here, $10 for $50 in total bit. We can see some trend in the data as well. Looks like the Morty customer is paying in the bill more. The customer is leaving as a tip. We will explore this in detail in a while. Let's play with kind perimeter fast. So what if we pass hacks? Let's copy this war and instead of scatter kind, equal to packs So the Ford is scattered. We're passing in hacks. Let's run this self So the plot looks different now. This is similar to scatter plot. If we look at scattered applause, it has darts in the plot for total bill and tips. And here we have hacks, a goat. So if we pass kind as hacks rather than displaying all points a scattered plots, the plot is showing the distribution with hex account, and the color distribution is telling. The data points within the EC cycle are critical. ERM or data points on there. The light of the color, the less data points are in that excellent. Let's pass him and other kind here and say we want right And around this So Raggi is actually a regression. We have not learned about Leni's aggression yet, and we will discuss this in details in the machine learning section. We will come back and discuss how the line is built, but at the moment, just take it as it is with kind equal to rag. The plot is like a scatter plot with the regression line drawn by Seaborn. This is just showing almost like a linear fit to the scattered Did appoint. Let's not make things very complicated in the date of Realization section. So with kind equal to rag, we're getting a line fitted toe over scattered data points. So let's move on and passing kind equal to okay, the poppy paste and passing kind equal to K D E and let's run this son there. So now we have a kernel density distribution. This is a two dimensional KD Plaut, showing the darker region with density where most of the data points matchup and the lighter regions were not many data points matchup moving forward. The next important one is Pierre Plourde. We will be using pair part function quite often in our course, especially in the machine learning section, while doing the exploratory data analysis so We want to have a quick look on our entire data to see the pair wise relationship. This can be done using see bones function Pair Plourde here brought plots multiple peer rise by variant distributions in the data set, let's call pair part no s and s dog Pierre plot and what we need to pass him the entire data sets because we want to have a pair of eyes relationship on our entire day does it. So let's run this self. So if you have a bigger date I said this could take some time because it's floating number of plots in the same time. Let's just decide so that we can see a complete plot here. So here we have. So the pair prod creates a metrics off access and shows the relationship off each pair of columns in our day does it by default. It also draw the univerity in distribution history Graham off each Vidia ble along the diagonal. So here we have total bills and here we have size tips. Total bill So tips worse. His size tips forces tip tips. Worse is total bit. So we have a complete overview on our data said, So we can see some trend hair tips, forces total bill and so on. Once again, please note that for the larger data frames, it takes longer time to plot to peer Plourde over Data said Tip is relatively small, so we're fine with the time here. So along with plotting pair wise relationship across an entire data frame for the new medical column, Pierre Plots supports a color with Hugh Argument as well, which is for categorical column ask for. For example, we can display information off the categorical column such as Male or Female, which is a sex column so we can pass him along with tips Hugh equal to sex and let's read on this cell here and here we have part in two different colors. Now we can see that all the green points are female and all the blue points are made. We can specify the color Polly, for example. We can say cool, warm and many other options that we will discuss in the style and color section later on. So let's move on to another very useful floor rug plot. Brock flawed. So let's move back to the same side of screen now here we have. That plot is a very simple concept, and just blood sticks on an axis for every data point on a uni variant distribution. So we can call s and s dot blood. I applaud. And let's pass in tips and the column Total bills we can express tap to auto complete. And let's run this, Celia so it should be rug plot. Are you ci less for you. So here we have the drug A plot. So what drug plot is doing? That plot is drying line for every single point in the past column, which is total bill. And these are the building blocks for Katie E plot that we have seen in our earlier plots. That's more want and talk about the that plot verses dis plot. Let's put rug plot and display Lord together in a single canvas. So what we can do? S and s daughter Brooke Plot and call tips Total bills Coffee this one base to tear instead of rug plot this float hips in total bill And let's say everyone color equal to thread. We know we get the Katie. Let's k a t e equal to falls so what we're doing. We're putting rug plot and displayed together on a single 10 with Let's on this self. So here we have a distribution plot and a rug plot. So the difference between distribution Plaut and rug plot is that the history Graham essentially has been and it counts. Khomeni sticks are lines are in that big, then sure it as a number up along why axis like we have more lines in this spin and it is higher than the previous one here. This one is highest. So we have. So we have maximum picks in this paper. Actually, the number off all the sticks in drug plot are stacked on each other in the distribution Plaut for the respective been. So the more lined in the drug plot higher the been in this plot and the less lined in the drug plot smaller depends in the district, Lord. So let's talk about Katie e plot now. So the kid EEB floors replace every single observation with a Gaussian or normal distribution centered around that value. So, with our tips data, if you want kiddie Plaut like s and s dot ready clock passing tips, and once again total builds. That's put rug plot and display art as well here. So rug and dist. So what we're going to do? We're plotting KD plot Iraq plot and dis plot for total build on the same camera So let's on the cell here. So here we have this line at the K t E plot. This green is a distribution plot and these blue sticks are the rug plot. So we see that this Katie is a Goshen normal distribution center around these values here. So let's plot this for tips. No, and see how it is different to the total bill that's on this show. So here we have a rug plot, Katie e plot and distribution plot for tip call. So, as we said, we will talk about the kernel density estimation plots literal. Let's try to understand kernel density estimation Plourde and jump onto the reference notebook. So here we have kernel density estimation plots, kiddy plot. So how do we actually build Katie line based on a drug plot? So now we know what is our applaud? Let's try to understand the condolence deplored based on the drug plot now. So if you follow this link. It is very beautifully explained how the kernel density plot is build. Let's try to understand, with these figures so difficult shows the comparison off history Graham on left and kernel density estimate on by which is constructed using the same data each off six black. 123456 and three and 36 six Black dashes in the drug plot with six individual kernel. So 123456 six individual kernels mean we have six normal distributions here on top off each line. This is the center of this line and we have a Gaussian distribution here, the colonel in debt that she are summed to make the kernel density estimate, which is a solid blue line. And the data points are the rug plots along the horizontal line. So these are horizontal lines. We have rug plot and this is our colonel and see estimation based on all of these red kernels for each data point in the log floor. So once again what Katie, eat us KD part replace every single observation with the Gaussian normal distribution centered on on the value for each value we have each cosy in distribution. So to get better understanding on Katie, let's Copley discord and basted in armor working north full. So don't for you about understanding this court, you will not use such cold in the data analysis. This is only to create a Bagram for you to understand how the K t e plots are calculated. I will go through the steps and explain what the code is doing. So in this step one we're importing Lump I, Matt plot Lip and stat from Sai Pie mrs. Another library in Vita Now, in the next step real creating a data set using random dot rand and from num pie. Then we're creating a rock plot for our data set using s and less door drug plot after that , setting up the X axis for the plot, using max and mean values in the data set. So we're finding the max and minimum value from our data set and setting the X and y me using data said dot mean function minus two, and it has a dot max plus true for X max. In the next step, we're creating 100 equally spaced point using Lynn Space. And we know how this Lind spacewalks. So in the next, every is setting up a bandit. And if you want to know more about this thing, you can follow this Vicky be dealing. And here we have the fumble off our bandwidth after that, re creating a empty list colonel list. And then we're using a for loop for data points in data said, create a colonel for each point and appended to list. So, Colonel, equal to start dot No, this is a king a formula. And you can read more about this thing if you want. If you press shift up once again, you don't need to worry about this court. The most important thing is how the kernel density estimation is calculated. So in the school were plotting the basis function and a pending the colonel to colonel list . And then we're setting the limits. Let's from this cell here. So here we have the output from our court. These are the lug plots. And for each drug plot, we have a Gaussian distribution and the duck Plourde is center for each cause in distribution here. So we need to something this is function to get the k t e applaud Let's copy and other block off court from the reference notebook. What we're going to do now, we have colonel list, which we have created hair, and then we are using MP dart some and getting some off Katie e along axis equal to zero, and the next one plotting the figure. And here we are, adding the initial drug plot once again just to see how it looks like. And, ah, Then we're getting rid off. Why ticks here? So this is just to make this plot better. Look, that's when the score here. So we have the kernel density estimation floor based on all these drug plots. So once again, what we did, we had the data point. And for each data point, we got the Goshen distribution where each data point is center for each guys in distribution. And then we're getting some off all bases function to get the K t. E plot. A single some off basis function, which is a Katie floored their job. Guys, this was all about distribution plots. I hope you got a very good understanding how this Katie E parts are amid. So in the next lecture reveal, Parker would categorical plots, which is another very useful and very important section in the data realizations using Seaborn C in the next lecture. Good luck. 10. Seaborn - Categorical Plots (Part 1): Hi guys. Welcome back to the sea Born. It's statistical data Realization section. Let's deal with the categorical data in this section. Sieben provides a range of options to plot categorical data. See Bone on its website in categorical did applauding section divide categorical plots into three groups. Swam plot and strip plot are those that show each observation at each level off the categorical variable box plot and while and plot are those that show the abstract representation off each distribution off the Operation Bar plot our point plot are those that apply a statistical estimation to show measure off Central 10 NT and confidence in Terrible. Along with the above mentioned types of categorical plots. We will also discuss widely used categorical plots such as count plot and factor plots in this section. Let's move on and start with the new Jupiter Notebook file notebook and bite and three. So here we have a new Jupiter notebook fasting. First we need to import Seaborne library. So import she born as s and s. Let's set Matt plot live in line as well because we want to see the plots within the Jupiter normal smash block clip in life we're going to walk with the tips data in this section That's Lord tips data into Texas or tips equal to S and s not Lord under school data set. And the name is tips. So we're actually using the see bones Building data set tips here. So let's load this Strata said it's always good idea to check how the data looks like. Let's check the head tips start had, so it should not disease or through here. We have total bills. Tip sacks, smoker, daytime in size. That's Addison sends here. So let's move on with the first plot, which is a strip plot here. Strip plot. Provide a simple way to show the values off some quantitative variables Across the level of categorical variable it draws a scattered Plourde. We're one variable is categorical. Let's plot the total bill for each day in the week in our tips data To see how the strip plot looks like. We can call strip plot using s and s dot stripped so always tapped for auto complete. And if we look at the documents, think shift top. Let's talk a boot X why and data active movement. So our x is they? So we're taking this column day. Our why is we want total bills here. Let's copy. Distant. And our data is Thanks. So what we're passing X reaches day. Why total bills and our data, which is tips. Let's run this. So here we have our first strip plot. We see that the data points are overlap. Like here. We're seeing lots of overlapping. This is common and makes it difficult to absolve the full distribution. In our data, there is a perimeter Geter which is useful and provide easy way to solve this overlapping issue. Jitter are just the position of data point along categorical access. It is them easier to see the distribution here. We have day as a categorical axis. We can specify the amount of data are we can just use true for good default. So let's copy this one here, basted here, express shift tab again. And here we have Geter equal to falls, which is default value. If we moved on. So Geter, this can be useful when you have many points and the overlap so that it is easier to see the distribution Let's pass in jitter equal to true. Here so we can copy this one here, the best shooter in passing jitter equal to true. And let's run this cell hair. Now we see the data points are not overlapping anymore. If you just shift up, there's an other perimeter Polly, which is none by default. Paella is colors to use for different levels after humiliate. So let's pass in palate equal to cool long, and we can pass in Hue s red equal to sex. And let's free on this cell here. So now we have male in blue color and in light orange killer. We have females, and the data points are not overlapping. This is optional. If you know if you want, you can simply delete it. And if you read on it, you're getting kind of default power here. So let's move on to this form plot. Now. Some plot is similar to the strip plot and uses different approach toe a wide the overlapping issue in the Data point. It positions each skater point on the categorical access with an algorithm that a wise overlapping points. This some whole gives a better representation off the distribution off our values. Let's call swamp lot here s fitness door Schwarm. So we can press tab for our to complete and we can pass in the same variables Here acts total bills. This is our data. And let's copy this one here the street here and passing Hugh equal to sex again. Let's read on this cell here. So here we have our first saw implored in this Plourde we have categorical variables along the X axis. However, a very common practice is to put the categorical variable along the vertical axis. This is particulate early useful when the category name are relatively long. Are there many categories? If the press shift top, we see here orient, which is none. By default we can pass in the forward. It'll are each for horizontal but usually plot Or the intuition can be in for from the data types of variable passed two acts or why? Let's try applauding days along why and a total build along axe with Hugh equal to time here instead of sex. Let's copy this cold based detail and we sent. We're going to take time as Hugh perimeters and our X is no total bills and our why is day . Once again, we are changing the axis for total bills, toe acts, access and our categorical variable, which is there were putting along. Why access? Our data is tipped and we're passing Hugh as a time. So let's run this cell here. Here we have our slam plot. So now we have lunch in blue and dinner in green color. We can absorb from this Plourde that almost all the customers come for lunch on Thursday. Not many green dots are in pastie, and on the other hand, almost all the customers come for dinner on weekends on Friday. Not many people go out for lunch or dinner on Friday. They may want to save money for Saturdays or Sundays, and maybe they don't have enough energy on that day, and they want to save their energy for weekends. This is obvious, and we see this trend most of the cases in our situation as well. On the last working day, we may not want to go out with friends and family, but on Saturdays and Sundays will usually go out for dinner with our family or French. However, on most of the working days, we are at work and we go out for lunch, but we don't really go out for dinner most of the time on working days. So let's move on to the distribution off observation within categories. Now let's talk about the box brought here. A box plot, also known as Box and Whisker plot, shows the distribution off quantitative data in me that facilitates comparison between Vidia Bols or across levels of categorical variable. Let's learn with some example now. So let's add few lines here. If you remember in our math block lit section, we had a short introduction to the Box Florida as well. So let's call That's in this bought box plot and let's passion acts as a day why as a total bill and didn't ask tips. So here we have. We have acts our day, why our total bill and data is tips. Let's run the cell and discuss what is box plot. No, the box plot shows the court tiles off, the data said, while the whiskers extend to show the rest of the distribution. Except for the points that are deter mined to be out lies using a matter that is a function off the Inter Kartal range. In statistics, the court tiles off a rank the set off did our values on the three point that divide the data set into four equal groups like one, 23 and four. Each group comprising 1/4 off the data quartile, is a type of contact. I'll the first quartile to one is defined as the middle number between the smallest number and the median. After data set, the second court trial que two is the median. After data, we're asked. The third quartile. Cute three is the middle value between the median and the highest value off the data set. Let's try to understand this box plots. We have portal bills along why, and we have categorical data along acts, which is our day. If you look at one off the box floor, we see that data points in each box are box and whisker plot are divided into four chortled groups like one too three and four, 123 and four, and same for all other boxes. Quartile Group one, which is Q one, is between the bottom Fisker and the bottom off the box from bottom brisker to the bottom off the box quartile group, to which is cute, too, Between the bottom off the box, toe the line in the box, which is medium. So this is our median here. This is the media Group three, which is cute. Three is between the medium and the upper end of the box. So from this medium to the upper end of the box and the last group Q four is from the upper and after box and the upper whisker. So we have Q one hair Queudrue here 23 here and Q four. Here. Let's introduce you equal two sacks or maybe hue equal to smoker to get more information from our data so we can copy this line feasted here, and that's a hue equal to sex. And if we want this cell no, we have female and male male in blue colors, box plot and female in green color box plot. We can set the color according to our choice we can passing Palley, she equal to rain bubble and reading this. Now we have changed the color. According to the human palate, you have each of options here you can explore more from the sea bonds documentation on Pelly. So in this box floor we split the data into two boxes for each day. Like Thursday were two boxes, one for male and one female on Friday, once again, two boxes, one for me and one for females. Now, from this box floor, we can compare Dele behavior after person, along with other category such a sex. Here. This is a true power off Cibo with quickly allow us to add and other layer using Hugh Perimeter and provides in depth information from our data, which is very quick and very small. So let's move on to the next one, which is royal and plot. Weiland plot. Draw a combination off box plot and kernel density estimate. I hope you still remember the kernel density estimate from the previous lecture. A violent plot plays a similar role as a box Plourde and fiscal plot. Let's plot the data and learn how the violent part applies. Let's copy this chord here, East it here and instead of box. We want Weiland and show our X's day again. Or why is total Bill and our data is tips again. Let's run this, sir. So here we have our Weiland plot for X equal today, and why equal to total bits. Actually, we have a box Plourde. This is a box floor on pop off Royal Implore. So unlikely. The box Plourde, the loyal implored allows us to actually floored all the compliments that corresponds toe actual data points. The violin plot is essentially showing the kernel density estimation off the underlying distribution as compared to the box plot, which is very easy to read. The violent plots are a little harder to interpret. They give a lot more information as far as the distribution off, all the points themselves is concerned. But on the cost off, more time to looking and understanding the oil implored before presenting such plots. Like while in plots, you need to understand your audience as they may want information in simple way. Let's introduce Hugh Perimeter in our while, implored so Hugh equal to sex and read on this score. So now we have male in blue again and female in green rather than having a set off violent plots next to each other. For male and female, we can use split perimeter, and if we press shift up, we have split equal to false by default so we can use split equal to True Split equal to True will draw half the violin for male and half the while for female. This will make it easier to directly compare the distribution in nested categorical variable. So let's pass in, split equal to true and let's read on this thing. So here we have. So in this plot, the blue and green distributions are split it in half off each violent for male and female . Now we can directly compare the distributions in the nested, categorical variable such a sex. In this case, once again, the violent plot gives lots off information and comes at the cost of spending more time for understanding and presenting to others based on your audience. If you're dealing with more technical people like data scientists at Sitra they may have used while in plots, and this is a great tries to use while presenting the data. However, if you're dealing with more eggs, active people like CEO or investors, you better use the box plot there because that is the more popular and commonly used for data interpretation. I suggest Onley yours. Violent plots. If you find something really interesting using this type of plot remember, understand your audience. The lecture is getting long. Let's split it here. And we will start from the same point in the next lecture soon. The next lecture. Good luck. 11. Seaborn - Categorical Plots (Part 2): So welcome back, guys. Let's talk about statistical estimation within categories, often another than showing the distribution within each category. You might want to show the central tenancy off the values. Si Bon provides an elegant raise to show such information using its built in functions. Let's talk about bar plot from this purpose. Bar Port is a journal plot that allows us to aggregate the categorical data based off some function by default. It is mean so we can call Bark Lord s and s dot bar plot. And, let's say X equal to the again Boy is our total bills and our digitize tics. Let's pass in Hue again and we pausing your sex once again. So let's on this court here we have our bar broad along, why we get the mean off total bills paid by male and female male in blue color and female in green color. We can change the estimate, object to our own function. Let's say we want to use the standard deviation as our estimate er for gender on each day in the week we can you number i dot STD for this purpose, or we can use our own customize function as an estimate of aspirin. Let's try to explore which gender have more variance in the total bill on each day, so our estimate will be standard deviation for this problems. So let's import numb Pie S and P. That's add fuel lines again and call the S and s dot bar port and passing X equal to day. Why equal to total bill and our data is again tips and let's pass in hue, equal sex. And now we want our estimator. Let's explore the documentation string here. So So we have estimate of hair. The default is mean and now we want standard deviation here. So let's passing estimator so we can call numb pi and p dot SD d This press enter here So let's run this self now. In this case, we have our estimator, which is standard deviation. So let's more want to another very important plot counts Floor com plot is actually a special case for a bar lord when we want to show the number of observations in each category rather than computing a statistic for a second valuable. This is similar to his telegram over a categorical rather than quantitative area in Siebel . It's easy to do with a count plot function. This is essentially the same as Barb brought, except the estimate is explicitly counting the number off occurrences. Which is why we only Parson ex fella meter here, our x ray liable or ex Well, you have. So let's call count Plot S and s not called flawed. And let's pass in X equal to day and our data equal to tips That's passing Hugh again. So now we have acts as a day. Data is tips. And who is sex? That's from this up. So in this floor, we're getting number of observations along y axis and blue is for male and dream is for female, whereas these along X axis, let's check the head off over data again tips start hand. Let's plot account plot for size. We want to know what is the most common size off the Kruk. So yes, in its dot count applause and we have X equal to size and our data is tips. Let's run this cell. So now we have group size to which is the maximum our grantees. So group size one very few occurrences. Six very few so very small, like a single person. And larger groups are not quite often where, as group size two is quite often three and four, maybe with some families or friends is also popular, but not as compared to the crop size, too. So most of the time people came out in pairs, so let's add a few lines and move on to the next, which is a point floor. So point Florida is actually an alternative style for visualizing the same information as if using bar floor it offered by the point plot function. Rather than showing a full bar using a bar plot function, it just plots the point estimate and confidence in terrible let's use point plot for our same data that we used for the bark cloth. Let's go back and copy that from the bar plot. So this one, our first bar plot. Let's copy this one here, basted here and instead of bar, we want point floor. True acts is our day. Why is total bill data is tipped and Hewes sex. Let's run this cell here. So here we have our point plot. So point plot the next point from the same Hugh Catterick like male for blues and green for females. This makes it easy to see how the main relationship is changing as a function off. Second, valuable because our eyes are quite good at picking up the differences off the slopes we can combine more than one plots on a single can was as well. Let's put Bar Claude on pop off point floor to compare. So let's copy this cord hair based detail and based it against So what we want. We want point plot and bar plot at the same cameras. So let's run this cell here. We have bar, clot and point plot together on the same canvas. If you remember, we can pass in l for just for transparency. Everything we want l for equal 2.5 for our bar plots. So let's run this end. This looks much better now. We have bar plot and point plot together in the same canvas we can combine while in plot in some plot as well. So let's combine while in plot and swamp lot. They are similar yes, in its start while in plot, and that's passing the same data. Copy this one Easter, too. That's to delete Hugh at the moment, and we want its form. So let's run this up here we have while in plot and storm floor together on the same campus . Let's change the color of thes data points. You also notice that few points are outside, the spoil implored so we can change this size and color hair as well. So let's change the color. She want black because Black is going to work for all these plots. And we want size off our point c three here and let's read on this thing. Now it looks much better. Most of the points are within the oil implored, and all points are with black color, and it's easy to visualize thes points. That's add morsel here just to make more space. And let's talk about Defector Partner Factor Prod is a most journal form off categorical plots it can take in a kind perimeter toe or just the plot type. Let's call the Factor Partner also s a store factor. We compressed air for auto complete and passing X equal to sex this nine, and why equal to total bill and our data is tips that's passing Hugh equal to a smoker and no, we want to kind equal to That's everyone box plot here. So what we're doing here, we're calling essence as factor plot function, passing data, X equal toe sex. Why is our total bill? Our data is tipped, Hewes smoker and our kind is box. So we're expecting box block in the output. Let's on this set. So here we have total bills along y axis, sex along, X axis, male and female. Now our hue is smoker. So yes, if they're smoker, they are in blue color And if they're non smoker, they are in green colors. The main advantage off using factor part is that it is very easy to facet deplored and investigate the roll off Other categorical variables. Let's try with other example using the same data. Let's pass in another argument which is column here. So sns dark tractor. If you press shift tab, we have called equal to none. So let's pass in call equal to time here. So X is our day. Why is total bill and we can pass in hue smoker here again, we want to know smoker or non smokers. Sure over data is tips and what we want. Let's say we want kind swamp. So we want some plot here and let's say we won't call and if we go back and see which column we can select at the moment. So here we have Time Day, smoker. Let's select time here. Call equal to time. Let's see what we're going to get in the right foot. Call equal to time is splitting the plot into two. Time is lunch and time is dinner on the left we have each day. People came out for lunch. And how many total bills they on the right. We have people came out for dinner on each day, and now it's very easy to understand. And it's very clear that most of the people came out for dinner on Saturdays and Sundays were asked on our left side. No one came out for lunch on Saturdays and Sundays. Everyone came out on dinner on the weekend. Well, as most of the people, I would say, most of the business. The restaurant is getting on the lunchtime on Thursday, so let's try another plot. He wasn kind, equal toe box and ah, now we can instead of time, we can pass in call equal today and we will have one plot for each day. So let's copy this one be issued here Act is our day. Why is our total bill Who is our smoker? Data is tips kind is say, we want Fox here and our call is there. That's from the cellar. So now we have the tested a Friday this Saturday, the Sunday Let's use an other para meter here and see aspect equals 2.5. That's really understand. So now we have better viewing off these box brought with aspect equal 2.5 shift tab. You can explore lots of perimeter to walk with. Let's use this deformed size We have box plot for each day Passed a Friday, Saturday and Sunday and Hugh is smoker. Blue is for yes, they are smokers and green is for no, they're not smokers. So this was all about See bombs capabilities off. Categorical plush. I hope you got a very good understanding off categorical plots in C bar. If you need revised this lecture, go through all these categorical plots. Once again, we are going to use these plots in becoming lectures quite often. Soon The next lecture. Good luck 12. Seaborn - Axis Grids: Hi, guys. Welcome back to the sea bone, A statistical indeed, a realization section. We are going to talk about access grids in this lecture exist. It's already important, especially when we're exploring medium dimensional data. This is a very useful approach to draw multiple instances for the same plot on different subsets. Off overdid, a set good charge or plots are also called panel or lattices. They allow us to quickly extract significant amount off information about the complex data in a series of smile graphs using same skill and access. This process allows easily comparison and provides a brief overview off the data. Under analysis, Matt Portly offers a good support for making figures that multiple access. However, Seaborn built on top of this to directly link the structure off. Deplored toe the structure off over data set. Let's learn that some examples using the does it. We are going to use tips and either state a sit in this lecture. We have already used tips in our previous lectures, whereas Iris is another very famous studio set. It includes three iris species with 50 samples each, as well as some properties about each flower. This data set is a part of C Bones library and can also be Don't load it from Taegu and you can follow this link. And here we have Idol status it available on tag. Alas, for which is actually contributed by you See I machine Learning Repository. We can follow this link to learn more about the Axis, create and visit the official documentation off. See bone. So here we have official documentation. If you want to learn more about the Axis creates, you can go through this documentation and see how the goods are working with medium dimensional data sets. Let's go back to the lecture again. One thing I want to mention here to use access did features Your data has to be in on US data frame. Your data frame should be structured such that each column is a variable and each group is an observation. Let's start with the new Jupiter Notebook file notebook and bite and three and first thing force. Let's import Seaborn as S and s and import. Matt brought Lip Doc T y plot as Plt and let's set Matt plot flip in line because we won't watch it in the Egyptian notebook. Let's on this cell. Let's load the eyeless and tips to does it from Seaborn. Sure, IRS. He could, too. Yes, and s dot If you remember, we used Lord underscore. They doesn't And call the Eilis, which is the name off the data set. And now we want bits equal to person s start. Lord Day does it. You can press tab for auto complete, and it's is the name off the data set. Let's run this. We always check the heart off the data and check the in four just to get a brief introduction or brief overview off of our data set. That's sick. I was dot in four. So here we have 150 entries and we have its length of the simple simple with battle and battle with and species. So let's check the head off. The do doesn't Let's add fuel lines and I distort head. So here we have separate lend temple it battle and battle lipped and species. So we have 1234 and five columns. So let's check tips. Not in four and run. Disa. We have 244 entries. We have total bills, tips sacks Smoker. Let's check the hand off the data, said tics dot head. We're already familiar with the status that we have. Total bills, tips given by the customer sacks, male or female smoker, daytime and the size off the party. So let's start the defecit grade physically. It provides a journal way to create grids off plots. This is useful when we want to visualize the distribution off the variable or the relationship between multiple variables separately, within subset off over the desert. If is it, good can be drawn. It upto t dimensions rule. Call him and Hugh the first to have obvious correspondents the resulting ari off axis. And you can think about humor variable as the third dimensions, like if you have roll along acts and call him along. Why and the few variable as 1/3 dimension is along the Dept. Off axis, where different levels are plotted with different colors. We initialized the physical object with a data frame and the names off the variables that will form the columns rose are Hugh dimensions of ticket. These variables should be categorical or discreet, and then the data at each level off the variable will be used for If s it along that axis, for example, say we wanted to examine the difference between lunch and dinner in the tips data set. Number of unique values in the Time and smoker We'll tell how many columns and rows our grid will have. Let's check the number off unique values in the time and smoker columns force, and to check the number of unique values and unique is a function that we can use So tips. Let's grab time here and let's check smoker aspirin and unique If we run this self, we have days, four days, tool times. Smoker, too. From the previous lecture we know we had four days Thursday, Friday, Saturdays and Sundays, and for time we had dinner and lunch. Whereas for smokers? Yes, I know Customer is a smoker on a non smoker, so let's add fuel cells and initialized the empty good for column equal to time. Andro equal to smoker so it's in their start festered grid remembers. This festively is with a capital F and Capital G, and if we check documents trained, we have data that we passing tips or ideas, rule and columns along with you There are several other perimeters like share axes, share y axis size aspect, and so many more like exclaim while him. The most important ones are Group column, and you and these are the tree what we're going to focus on in this lecture. So let's pass in data first. Can the one time and rule we want Smoker once again Time. We have two unique values and smoker. We have two unique values. So just a guess how many parts we should expect from this line two unique values in time and to unique values in smoker. So column equal to to throw equal to two. So we should expect four plots here. So here we have it did with four canvases are four plot. Let's make it little smaller just to fit it to the screen. So here we have we have four plots. Let's pass into a variable G and read on this cell Here we have. So the main approach for visualizing data on this great is by using festively dot Map are we can call g dark map mattered. Let's look at the distribution off total bills in each of these subsets using instagram so our data is now total builds and we want time for columns and smoker for Rose. So let's copy this hair wasted here and called g dot map and what we want. We want history, Graham. So plt dog hist and over detox is total bills We can pass into g again. So here we have. So what we're doing we're creating an empty great hair using facet grid and then putting the data on that using dot map function. There were passing the total bills and asking for history grants. Let's from this self. It should be Bill not Builds. So let's run the cell again. So we have rule one for smoker. Yes, smoker. Yes, and wrote to first smoker No smoke or no, It has called him one for lunch time and call him to for the dinner time. So once again, what we're doing in this plot were mapping a plot type hissed far total bills and separating the results based on column, which is Time and rose, which is smoker. The output is labelled so that the X axis represent total bills. These four plots are labeled as yes or no along the rows for smoker and lunch or dinner along the columns for time. Let's try and other type of Plourde, for example, scatter plot here, which takes more than one argument, every passing, only one argument. So that's passing more than one argument now. So let's copy this here this detail and instead off hist. We want scheduled plot and four scattered applause. We need to arguments. So let's take tips for the 2nd 1 So let from the set, let's make it a little bigger. So here we have smoker yes and no along the rules. Time, lunch and dinner along the columns. We have portal built along acts access, and we have tips along. Why access? Let's pass in another argument, Hugh Herr, which is, Let's say sex. And now let's display the legend. So we need toe add legend here because it would tell us which color is for which sacks and let's read on this cell again. So this plot is giving MAWR information now. So with Hugh equal two sacks as 1/3 perimeter or at the third dimension, we're getting more information. Let's move on to the next one and talk about bear. Great pair grid is a subplot. Cred for plotting otherwise relationship in a data set. It's kind of an automated joint floor for the entire data set. See bonds pill Get Magan ism for whites. Great control over the out foot plots. We can customize our pair plots in Evie. We want Let's Play with Island Strata said Now, and learn more about the pair grades. So let's check the head off. I response again. So here we have ideas. Do does it? Let's call it. Agreed on Empire Data set? Yes, In this dog, he has it. So once again, this spirit is with a capital P and Capital G. And if we press shift top, we have data, you palate and so many other para meters. So let's pass in data here at the moment. So our data equal to find us. We can simply passing Eidos aspirin like, in this case, simply ill. So let's run this set. So here we have a complete great for our day, Does it? That's fit this one. So the plot along the first column would be separate lent prattle with CEPAL int petulant and supple and simple it Zeppelin and supple it. This is how the pill grid provides the information on the Empire, Data said. Let's put some data on this one now, so let's fuel cells and copy this one vested her pass into G. And once again, we need G dot map and we want scattered port PLT door schedule. Let's from this. It depends on your computer and the number off dimensions in the data. It could take longer time if you have more dimensions in your data. So this is the scatter plot for our entire data set in this group. We can actually control our parts. We can specify what we want to plot along the diagonal using map Underscore dyke function and what we want on the other part using map underscore off dark function. Let's copy this one faced it here and let's see. We want history Graham along the diagonal so plt dot hissed instead of map. We want map under school stock. Let's run this cell. So here we have the history grams along the diagonal. Now let's put sketch report on off diagonal. So that's called me this one. The street here and instead of map underscored ag map, underscore off and let's put scatter plot. So now what we're going to do, we are going to put history grams a long diagonal and on all other places, we're going to put scatter plot. So let's run this set. So here we have. We have two types of plots history, grams along the diagonal and scared deplored on all other places. We can get more information from this plot that's passing Hugh Argument Aspar. So I asked. And Hugh, we can say, We want your species. If you go back, we have the third column species. And if we don't this cell. So here we have battered representation off over data. Now we have more information from our data. One thing we don't know which color is representing. What? Let's add legend aspirin, Sergey dot We know we can use add underscore legend. And if you're on this cell here, here we have now these trees species are represented by three different colors. Instead of diagonal and off diagnosed, we have further control on our grid. Let's try to put different plots on upper and lower triangles. Once again, let's start with G equal to lessen start. You can always play staff for auto complete on our data is eyes what we want. She dot map night and we want CS and s dot dis plot instead of history. Graham, that's called this plot here and g dot map underscore what? So this upper is going to put floor on the upper trying so upper left sport BLT dot scatter and g dot map under school lower. And ah, that's put Katie e plot here. So s and then start. Okay. Okay, flock. So we're grabbing either state off for pair. Good. Putting this plot along the diagonal and then putting scattered Plourde along upper triangle and Katie e plots on the lower triangle. Let's run this cell here. So we have three different types of plots on the same grid for our data. Now we have more control on our jet. Let's recall our understanding off airport from the earlier lecture on distribution plots. Remember, we just passed in the data frame to bear plot matter, and it will automatically kid a peer plot for us. Pierre Prat is actually a simpler version off period. We will use peer plot quite often in the scores. So it's important recall this simpler version fast. It's called Pierre Plot Again S and s Storm Pierre Plot and passing data I us and let's run this self. So here we have the pier plot for our I'll status. It does look much more informative. We can expect more information from this Plourde. What if you pass you here and we say you it's our species which is our categorical column and let run this cell here. So this is what we have? No, We have more information from this plot. We have three different species represented by three different colors. We can change The color scheme has been using Pelley. Let's say we want rain Bull and read on this cell and we have different color scheme. We can use a change of color scheme provided by C Bond. Let's move on and talk about the joint. Great Joint Click is a journal War agent off joint Plot. You're already familiar? The joint floor from the earlier lecture. Let's recall the joint floor That's an s dot joint plot pets passing X equal to total bill and why equal to and our data is tapes and let's run this self. So we had this type of plot from joint plot function in the previous lecture. So this is actually the simpler version off jointly. Let's use Joint Creek now once again, the similar syntax ci equal toe s and s dot capital check and capital G joint grade passing the same perimeters. Copy and paste them here and left from this self here. So we have initialized the joint grid here. Let's for the data on it. G dot floor we want s and s door blank plot and yes, and then start this deplored. So let's run this cell. So here we have our rag plot and display lower on the joint grade. So, guys, this was all about the axis creates. Let's have a quick overview on this lecture. So what we did we imported see Bon and Matt problem then reloaded ideas and tips. State assets. Got some information on those data sets moved on, and we started with faceted. Clear how we create a good and then how we put the data on the great. So moved on. We used Hugh perimeters, and now we can get more information from our data for the period we initialized a period using either a state asset. We had four No medical columns. So four rows and full columns here we can put different plots on different part on the pill . Great. And here we have history grams along the diagonal and scatter plot along off Wagner. We can further control the great by putting different plots on upper and lower triangles. And here we're putting three different types of floor along diagonal, upper and lower triangles. We can further pass in hue perimeter and get more information from our data. So now these three colors are from T different species. So moved on to join it, which is actually a journal version off joint flawed. And then we put some data on the joint it as well. So this was all over. Access gets Let's move on and talk about other important features and other important types off large in CIB. On seeing the next lecture. Good luck 13. Seaborn - Matrix Plots: Hi, guys. Welcome back to the Sea Born a statistical data realization section. We're going to talk about match explored in this lecture. See bones match explored, such as heat map alot us to plot the data as color in corden mattresses, whereas cluster map can be used to indicate clusters within the data. In this lecture, we're going to see how the heat map and cluster map looks like. Later, in the machine learning section, we will learn how to formally cluster the data. Let's learn with example and start with Jupiter North Book First thing first again, some import she born this this and this import Matt walking people I applaud s plt and set Matt plot leap in line. Let's run this up. So we need data to walk with next Lord. Two data sets again tips and we know how to Lord did us that sns dot lord Data's have passing the name tears and the second day does it flights? That's in this thought. Lord did a set and flights. Let's run this, sir, and see whole digital look like so we already have enough information on tips. Let's check the flight students flights. Thought in full, and here we have 144 entries. We have Year, month and Passengers column. Let's check the head off to desert Flight Start. So here we have the head off over data set, so flights data set is actually on number off. Bissinger's flew in each month on some ear like 1949 in January. 112 passengers flew April 1949 1 29 passengers flew. So let's start with the heat map. Heat map actually plot rectangular data as a color in corded metrics and is a primary way of showing Matt explored In order for heat map toe walk properly, our data set should already be in the image, its form, the S and s dot heat map function. Basically just color the data for us for instant. If we take a look at our tip State of frame so tips dot hud, we have a column total bills, which is some sort off label. If you look at one of its value say 16.99 at first place, the roar is not actually the variable. In order to get it into a variable form, we need to have both variables on columns and drawers. We can do this usually through pivot table or trying to get Correlation dater. And if you remember, we learned about pivot Table in our previous lectures. Let's take the correlation here using core function on our tips data set, we can get a magics farm off over data set with Coalition between the columns and indexes. Let's call tips start poor. So here we have total bill to total bill correlation, which is one and it's obvious. Tips to tip relationship one. So along the diagonal, we have relationship between the same variables. In the second column, hair 0.67 we have correlation between tips and total bills and then size and total bills. We can visualize these numbers in colors. We need to simply call the heat map here, So SNS dog heat map and passing tips start core you foot on this cell. So here we have a heat map for our correlation data. Along the diagonal, the variable has coalition toe itself and often Dagnall. The variable has a correlation to another variable. We contain the color map using see map, see map Say we want rainbow and read on here we have reasonable. It's quite bright. Let's passing cool wall. She's an other color scheme here we have cooled long. We can put these numbers on the heat map as well, and for that we use and not equal to true. And if we run this said, we have these numbers on our heat map. If you press shift tab, you can see range of para meters you can walk with. You can go through this document to explore more on the heat map. Let's look at the flight. Do does it Now remember, we need to create a pure table fast because we need to convert this data into a metrics form. Let's call our understanding off pivot table from the previous lectures so flight dot people table We have values index and columns. That's copy these three arguments and pissed them here. We want the singers as a value month as our index and the third column is a year, which is our columns. So what we're expecting our values will be the number of passengers. Our index, which is a long roll, would be month, so each month will be a single draw and our column will be here. So let's pass into PTF pivot table for flights and run this. So let's check PTF now. And here we have We have years 1949 up to 60 as our columns. We have month as index. Each role is a single month and we have values number of passengers. So now we have data into a metrics form. Now we can call heat map on our date. So let's air fuel cells and call heat map s and a start heat map and our data is b d f So hairy, what we're doing We're calling heat map on our data PTF, which is actually in the metrics form. And we have used pivot table to convert our data into magics for Let's run this self. And here we have the heat map for our duty. Let's play with the color schemes and other para meters before we discuss this plot and the data. So let's pass in, see map equal to weaken, say magma another scheme and run this cell here. Now we have better visualization off over data. We want to separate each block that's passing another perimeter lying and we want white here and we say Line verdict equal toe one and let's run this self. So now we have white line separating each block. No, If you look at this map, we see that the overall number of passengers increases as we move from 1949 to 1960. This makes sense because more people used airplanes with time and more flights for available with the passage of time. We can also absolved that popular months for travel are usually the summer months, July, June and August. This is again obvious. Schools are off. People want to have some fun time during the summer months. Let's move on and talk about the cluster map. Now the cluster map uses hierarchical clustering to produce a cluster watchin off the heat map. We're similar groups are close to each other. Let's call the cluster map for the same day. Does a P. T. F. So s and s dot fluster map. You can always plus staff for auto Complete our data cities B, D F. Let's run this cell here. So this is just a warning between two versions. You can simply ignore this warning. Let's fit this and here we have a complete cluster map on the screen. What is that? How would the years and months are no longer in order? Like 1949 1950 1954 1953 and after 54 we have 51 and then 19. 55 is somewhere here. And if you look at the months, September, July, August, July, the months and years are not in order anymore because they're grouped by similarities in values. And here the values are passenger count. So if we look at deplored, July and August are similar because more people travel in those months. That makes sense because both are summer travel. Months 1959 and 1960 are similar, and they put beside each other. We can play with the color schemes here as well, Like we can pass in. See map, I say we want cool, warm and read on this earth, and here we have better visualization off our cluster map. So these months, a ghost in July are beside each other with darker color. 59 60 are beside each other, and this makes sense because they are trooped based on the similarities based on the number of passengers. One thing notice. Here we have a color bar here. The passengers are from 0 to 600. We can standardize the color scare and that is really easy to do. Let's copy this one and paste it here. And if you press shit top, you see you have a perimeter standard scale. It's none by default, That's copy this and paste it here in our standard scale is say we want one. And if we read on this cell here we have our scale from 0 to 1. Now, based on normalized scale, we get much better understanding of over data. We see that the winter months, November, February and January are always Lopez Singer months. While the summer months with red color are all the time, high sales are more passenger months. This was all about heat map and cluster map. I hope you have a good understanding of heat map and cluster maps and how useful they are to visualize the data. It is always important to get as much information as possible from the data set. And these maps are very helpful to visually represent the information from our data set. You will see the people like visual information. I hope you got a very good understanding of heat mat and cluster. Matt. The usual information is always helpful. You have range of perimeters to play with in these maps. See, in the next lecture there, we will talk about other important features in the Seebohm. Good luck. 14. Seaborn - Regression Plots: Hi, guys. Welcome back to the Sea Born a statistical did a realization section Let's start Hable progression plots. In this lecture, Seaborn have many building capabilities for regression plots. In this lecture, we've been learn l employed matter literal in the machine learning sections. We will cover regression plots in details that's more want to the Jupiter Lord book and learn by doing. We're going to use tips, data set in this lecture file new notebook and bite on three. We need to import see bone and math probably. And we're going to set match broadly in line as for so that we can see the plot within Jupiter notebook. So import she born as S and S import Matt float leap Not the people I applaud asked Plt and Matt plot lip in life and let's run this set. Let's lower the tips Day Does it tips equal to s and s dot We can use Lord function load data set and you can use tap or to complete and tips. It's all this good idea to check the hand off your data set, So dips start had so here we have once again total bill tape sacks smoker the time and the size of the party that said few cells here. So moving forward to l employed l implored function allows us to display a linear models with Cibo The method flock the data and regression model fits across. If Essid Group this function actually combines like plot and festive grit, let's call. L implored s and s start L m a lot and passing acts equal to once again Total bill. Why equal to let's say we want tips and our data? Is it? It's Let's press shift top to check its documentation string. So here we have ring of perimeters acts. Why data? Hugh? We can use column, Rose Palley and lots of federal perimeters we can play with. So at the moment we're passing acts as total bill. Why equal to tip and data is tips? Let's run this cell here. So here we have in this floor we basically have a scatter plot with a linear fit to our data, which is on top off scattered floor. Let's copy this court and based it here and passing another parimutuel, which is Hugh. So we can pass in you equal to sex and see how the things change with this perimeter. Now you can notice that we have male and female separately with two different colors green and blue. So in this floor, you equal to sex conveniently split up the plots as well as color the HEU based on the categorical features. So now we have to scatter plots and two linear fits with two different colors on top of each other. We observed that as far as total bill worse, his tip Arkansas male and female have similar fit to the data we can pass in the match port lips style perimeters in these plots as well. For example, let's pass in the list of markers for male and female. For this, we need to copy this again basted here and let's and an other one Monica here. So passing the list say we want circles and we want triangles. So let's run this and here we have. So now we have circles for male and triangles for female. You don't need to worry about remembering these perimeters. You can always go to the top string and look at these perimeters, and if you move down, you can read the explanation and how to use thes perimeters. Sieben has a very good documentation on all off its features. So let's move one and see How can we change the market size? So copy this one again basted here let's add fuel cells. So now we want to change the size off the marker so we can't passing scepter kw us equal to end dictionary We're s equal to I say we want 100 and yeah, and if we run this here we have changed the size off the marker. So let's pass in 200 see the marker. Size is much bigger. That's a check for 500. So 100 is quite good actually, for this plot, let's check in other feature actually and ah, passing here the palley and we won't see a rain bull any food here. So we have different colors. We can check cool, warm And so we have range off options in see bone to play with as far as police concern, we can have more very able separation through columns and rows with views afraid in Seaborne Astra. So in this case, we just need to use column and row arguments in Ellen plot so Let's check S in this talk and implored. And if we shift top, we have call, um, and rolls that's passing X equal to total bill. Why equal to deep data is tips and let pass in call equal to sex. And if we run this end, we have two separate columns for each sex, male and female in the column. One. We're getting a plot for total builds versus tips for males only. And in the second column total bill versus tips for females. We can passing rules aspirin. So let's pass in, roar equal to if we go back and check the day does it? And here we have Let's pass in time here so time. If you don't this cell No, we have two rules. Let's fit this to the screen. So here we have column equal two sacks row equal to time. We have two times, which is lunch and dinner. So roll one for lunch and grow to for dinner. Let us call him equal to sex, one for male and the other for females. Let's use the hue perimeter along with columns. Now if we copy discord here based you tear and instead of column equal to sex. Let's pass. Say we want Hugh equal to sex instead of time. So now what we are asking, we want Call him for the is and we want you for sex. Let's end this set. So now we have first of Friday, Saturday and Sunday. We have four columns, one for each day, and we have two different colors off plot on top of each other, one for me and one for female. We can play with palate hair, aspirin. So P P l e. That'll teach you and say we want clean. Yeah, And if we're all this thing So we have a different color scheme here we can pass in rainbow and there are lots of options you can play with. So let's more One to another very important feature, which is aspect, ratio and size so we can adjust the size and aspect or issue in the l implored aspirin. We need to pass in size and aspect perimeter to do this thing. So it's in a stork. I'm floored If we press shift tab once again, we see we have size and aspect. Default is five and default aspect iss one. Let's copy these lines. Of course, these two tier and now passing aspect equal to save anyone legal point five and size equal to 71 10. And if we run this cell So these plots are now the different aspect ratio and they are different size. We can change size to say, Let's try to give a very small weddings. Therefore here. So here we have a very small plush. It all depends what size of plot you want for your reporter for your data presentation. So let's say we can change this aspect ratio 2.7. And here we have different aspect ratio for our plots. We can change this to se nine, and here we have different size off report. So this was all about Ellen plot at the moment. That's what we want to the next lecture. We're going to talk about another very important feature that is usually ignored by early stage data scientists, which is figure s tactics seeing the next lecture where we're going to talk about figure attack. Good luck 15. Seaborn - Controlling Figure Aesthetics: Hi eyes Welcome back to the sea born statistical Data Realization section. We're going to talk about one of the most important aspect in the dead representation and report writing, which is figure aesthetics. This very important aspect is widely ignored by early stage. Did a scientist which could significantly reduce the impact off all your efforts at the end ? All this pay attention to the figure statics In the previous lectures we have seen a couple of times how to control figure s statics in Siebel. But in this lecture we will formally go through the figures statics. So let's more want to the Jupiter notebook and figure new notable. So once again, we need to import Sieben Mac plot lip and set the Matt brought lib in line. So import Seaborn as s illness Import Matt Plot Lip Dr P Life Lord As Plt and Matt plot leap in line So let's run this So let's load the data again Tips equal to yes and they're stalked. Lord, I hope now you know how to use this load Data set function in ah si Born to Lord the building, their desserts passing the name off the data set and let's check the handoff deeps here. It's always good protecting data. So here we have all our gear. Does it the first thing we're going to talk about this set under school spy function so we can set particular style using this set under school style function. To call this function, we have to use S and S start set underscore style. And if we press shift tap, the default value is none. And we can pass in dark grid white, greet, dark white and ticks. Let's use deformed, active woman fuel cells. And let's plot a simple counterpart SMS count, plot and passing X equal to 71 sex and our data this tip and run this. So this is the default style for Sieben plots. Let's set style tests in their store, sect style and passing. We want to see white. So now what we're going to do, we're going to set the style as white and fantasy employed if we want this court. So now we have it playing background, which is white in the back. Let's parson picks and run this again. Now we have takes on deplored. Let's said the dark did and run this thing. So once again we have the dark red hair so we can pass Invite did. And here we have white grade so we can play with these styles. So usually it's very common to pass in white. So it looks quite nice. Actually moving forward, we can remove access spines. Astra and SNS provides a very simple way It removes find which is simply a d spine function . Let's copy this one basted here and C s and s dot these spine If we press shift, Top top is true. Rightist true left is false and bottom is fault. But this thesis spine we're only getting left and bottom spot because they are false. Let's run this cell here. So here we have bottom and left spine on Lee shift top and copied these ones and we can pass in false here. So now we're setting all falls. So we're getting all spines in our plot. So here we have every passing left True bottom true. Let's it all true. And now we don't have any spine toe our plot. Let's trackable figure size and aspect. We can simply use Matt brought Libs plt dot figure and passing figure size with victim height to change the size of most of the Sieben plots. If you remember plt dot figure and if we should tap, we have fig size. If we copy this one, we used to passing to pull hair with some figure size. Say we want to pass in 12 and three And now let's copy this court here based you tear what we're doing. We're using bad product clips capability to change the figure size here. So figure size we're passing 12 3 which is width and high, that from this cell. So we have a different size off our figure. So we have changed the size off our figure with simply Mac prototypes capability off changing the figure size. So another example to change the size and aspect ratio off your figure is that we have seen in our previous lecture using l implored Let's recall that one s and s dot l implored and exp equal to total bill. Why equal to keep and our data equal to tips and let's set the size eagle to say five and aspect equal to two. If we run this cell here, we have change the aspect and size for the figure. If you remember, we used this size and aspect perimeter in a previous lecture. So in the previous lecture, every passing aspect point someone and size 0.0.9 and we played with the changing the numbers here like we passed in different number to see all the aspect ratio and size changes. So let's more warn to scaling the plot elements. See, Bone has a great capability using set underscore context function which allow us to overwrite default perimeters. So let's check this in their start, sit context function. So everybody s shift tab here we see we have contacts none. And foreign scale is equal to one which is default, and RC is not. If it moved on, we see that we can change this context to paper, notebook talk or poster. We can pass in the fourth scale, which is a Florida and optional. If we moved on, we see that we can set the context to paper weaken, set the context to talk and passing the forint scale. Whatever we want, we can use our see perimeter pass in the dictionary and in this case for line with and so much more Let's set this to paper and say we want point scale se three and once again s in the start coat plot passing X equal to sex. Our data is tips and let's run this So using this set contacts, we have changed the figure According toe over requirement, we can pass in the fourth skill. Say that's pass in five and see how that things change. So here we have much bigger tax around Deplored If we pass in one, this is quite small so we can play with this thing like to And whatever our requirement is , this is quite reasonable to present in the paper. So great job, guys, if you want to learn more about controlling the figure Ecstatic check. See Bones. Official documentation about figures. Statics. This is very important when you're presenting your data because the presentation and the data should clearly convey the message. What you want to tell everything should be well presented and clearly seen by the audience . So always pay attention to figure aesthetics. You can see the great impact off your presentation when you put some time on figure s statics. So this was all about. See bone at the moment we have learned range of functions and the capabilities off. See Bone for DW realization. Let's move on to the exercises section. Seeing the next lecture Good luck. 16. Seaborn - Exercises Overview: Hi guys. Great work. I'm super excited now because we're about to finish the detail Realization section. So far, you have done a good shop. It's time to practice and test the skills that you have learned in the previous lectures. In this Seaborne exercise lecture, we're going to use three data sets, tips, ideas and another very famous Titanic did. Is it? These data sets are included in the sea Beaumont built in day Does it library. You have to do some exploratory data analysis using see Bone and present useful plots for the realization. Let's have a quick overview on the questions. So the first thing his importing Seaborne Matt brought lib and setting match brought lip in life. So the first thing he's asking for set style, toe, white Lord, tight earning tips and ideas did I say I hope now you can easily lured the building. They does. It's from the SNS. They doesn't library. Moving forward. He's asking for the heads off all the data sets here, and then the create deplored below used tips data set hint is pay attention to X and Y labels. So here axes day. Why is tip so the legend is male and female, and he's asking to recreate this plot moving forward, so recreate the plot. Below Use tips. State asset hint is again Pay attention toe X and y labor. So once again, total bill and tips You can see this is a giant plot here and moving forward. Now he's asking to recreate. Displayed here. Used the Titanic data set once again, pay attention Toe X and Y labels. So moving forward once again he's asking for this plot where, using the Titanic data set once again pay attention to X Y labels. So Axis Class and why is age in the next plot? He's asking for the create deplored below. Using Titan did. Is it pay attention to action y labels. X is fair. And why is age in this case in the next floor he's asking for recreated the plot below used Titanic did a set. So once again, our class is a long axe. Axis ages along. Why access and you need to create this plot So no, he's asking for swearing, plot using tight end did is it so you have to be clear. This plot here, So moving forward. Can you plot home. Any male and female war on tightening separate them based on their class, so you have to recreate this plot once again. So in the next one, recreate deplored below using IRA state. A set hint is bare grid. I hope you can create this plot now. It's very simple using a single function in Cibo Moving forward. Recreate deplored below use Titanic data set hint is facet Craig. So you have to use facet Great to recreate this plot. So moving forward, another very simple plot he's asking to recreate, which is actually a heat map and hint is met. Explored. You have to use Titanic. Did I said here. And if you notice, you have to put these values on your heat map as well, so I'm sure that you can do all these tasks by yourself. Try them first before you move onto the next lecture, where we're going to solve these tasks one by one. Seeing the next lecture. Good luck 17. Seaborn - Exercise Solutions: So welcome back, guys. I hope you have already solved all the tasks. They must be very easy for you at this stage. That's more want and try to solve these tasks one by one. In this lecture, that's not the cell to import. Seaborn and Matt brought lib. So every have the first thing is asking for set style to white. So yes, in a store, if you remember. Set style, function, set style. And we can pass in white here if we run this cell. So we have said this timeto white. Now, the next one is Lord tightening data, set tips and Iris. Let's, Lord, these data sets here. Titanic equal to S and s start. Lord, you can press tab for Auto Complete and Paasschen and Titanic. Let's copy this one placed it here and taste again because we want three data sets and the 2nd 1 is tips, IRS dips and itis. Let's from this son. No error. So we have loaded all these data set. Let's check the head off all these data sets now titanic dot head. So here we have the had for our tightening do. Does it? So this is what he was asking for in the next one. Head off the tips. Data set tips start her. It's very simple once again. And here we have the head for tips to desert. And in next one, Iris. I just thought that so that's on this. That here we have the head off over Iowa State Asset. So moving forward. Recreate the plot below used tips, status that pay attention to accent. Why so our exes day and why is tips? If you remember, this plot is a box floor. We can call s and s start box Plourde press tab for auto complete. I'm reminding you again and again like you can use tap for Archer. Complete X is the and why is and our data is picks and let's run this cell here. So now we have day long packs and keep along why he's asking for meal and female as two separate boxes for each of them. We can do this thing simply by passing in hue equal to sex. And if we want this cell here we have the same plot. We have the same out foot male in blue, female in green de along X axis and tip along y axis This war really clear. Deplored below use tips. Status it pay attention to ex envoy labels. If you remember, this is a very simple joint plot. We can simply call s and s Joint Blart and what we need to passing total bill and tip. So our X is total bill and over. Why is tip bid as our data is tics, if we run this cell here we have. So by default we are getting a scatter plot. But in this case, he's asking for high explored. So we need to pass in another argument. If you press shift tab so you have an option here, which is kind and default is scatter. Let's copy this one basted here and passing tax and run descent. And here we have the same plot. Let's change. Decide to fit to the screen Moving forward The create the disc locked given below use Titanic data set once again. Pay attention, toe why and acts. So he's asking for this plot s and s start this plot so we need to grow up. Feel column from our Titanic did asset so titanic and fear from this cell so here we have. If you remember, display. Laud this floor. Display the kiddie aspirin. So we need to get rid of this Katie the line. So Katie e equal toe fault. Let's on this end. So we're heading towards the outward what is required. So the color is green here and let's read on this cell. So we're getting the similar stuff, What he's asking for, The only thing I can see is the didn't size are different. So in this case, beans are actually 20 So let's pass and means equal to 20. So here we have the same output. So what we're doing, we're grabbing the Fear column from Titanic setting Katie E Falls Color green and beans to 20 in display. Moving forward, VT ate the box plot below. Use Titan data set. Pay attention to accent while able our exes class and our why is age Yes, in a start, VOCs floor and passing X as a class. And why, as a judge X is class, Why equal truth, age and our data cities Titanic. Let's run this so we have 1st 2nd and third classes along X axis and age along. Why axis? So we need to split this 12 alive. No and yes. So for this purpose, we need to pass in Hue here. Que is alive if we don't decide. So we're getting blue for No, they couldn't survive. Yes, for me. These guys survived in the Titanic incident once again, Onley different is the color and this color. What he's asking for is a cool war. So let's pass in pallor here. Cool, warm And if we don't descend So we got the same output here. So what we did, we called the box floor passing class as X y age did eyes tightening. Hugh is alive because we want to have separate boxes for people are the passengers who survived and who could not survive and the palace school walk. So the next one he's asking for recreate deplored below using Titanic data said pay attention toe acts and why again? So once again, this is a joint plot. So s and s start joint plot passing fair and age. So our X is fear and were why is age and our data is Titanic And let's from this cell. So here we have the same plot. We don't need to do anything more than this because he's asking for simple joint plot for acts as fair And why, as age for the Titanic did is it so in the next one, the clear, deplored below used Titanic data set. So our class is along AC sexes ages along. Why access? This is the similar plot. Actually read it before. The only thing we don't need to pass in Hue. So something like similar to this one toe s and s start box Plaut passing Xs. Plus why s ich and our data is Titanic. Let's run this cell here. So here we have the similar Prague. The difference is the color hair and this color is actually rainbow so we can pass in this palette equal to Reinbold. With the passage of time, you would be easily recognized. What colors came his using indep large. So you have lots of option toe select and you can explore a little option from see bones official documentation. So let's run this cell here and here we have the same plot, that same color scheme class along X each along Why three boxes for 1st 2nd and third class . So the next one is so I implored. Once again, Titanic data set and he's asking to use factor Plourde. I hope you still remember the function factor plot. So let's call factor. Plot here factor Plot. Our X is class. Why is eight and one thing You notice that you have a separate plot for male in separate part for females. If you press shift her, you have an option here, which is column. So these are two columns for sex so we need to pass in column here. Aspirin. Let's try to recreate this plot. X is Kloss. Why is data is Titanic and call is sex If you press shift top You know what is that Days? A perimeter kind which is by default point and we don't want point floor. We want some plot. So let's pass in kind, equal to swarm. So your foot on this sub Here we have our out foot It looks similar to this one and the only difference once again is the color scheme. If you can recognize this one is again Rainbow Let's pass in Pella here again So public equals toe brain. If we leave this cell here we have the same plot. We have recreated the output. What he was asking for moving forward. Can you plot how many male and female war on Titanic separate them based on their class? So you have to recreate this plot. So this is a simple Count Florida here. So let's call s and s dot com plot here and what he's asking for a long X. We have sex so X equal to sex and our data is Titanic. And let's run this set. So we have female and male sacks and count, but we want class 1st 2nd and third. We can simply pass in and other Parliament of Hue here, which is class. So we want to split these bars based on class. So let's run this self here. We have the same output what we're doing, we're selecting Sex column from containing data and passing hue as class. So moving forward Very clear, deplored below use either state. A set hint is bare Great. I hope you remember the lecture on period. So let's try to recreate this plot If you remember from the lecture what we did, we initialized the pair great G equal to s and s dock and pier grid with P Capital G Capital. I feel good. So the data said. He's asking for isles and you here we have species. If we don't this so so we have created the great Let's put the data on this group now. So along the diagonal we have to put the history Graham and along the off diagonals we need to put the scatter plots, so d dot map ni and what we want. Plt dot paste and G dort map off bug. We want plt dot scatter. Let's run this cell here and here we have we have the similar approach. The only difference is we don't have this legend here, so let's call another function here. Add Ledgett. Sorgi taught ad religion and run this cell here. It takes time. So Harry her. We have this similar plot in the output, so let's move on. And the next one is the clear deplored below used Titanic data set Hint is facet grid. So let's call faceted here instead, off pale great Sorgi equal to yes in this dog. Press it good and data he's asked for Titanic. If you see he's presenting male and female in two columns. We need to pass in column equal to sex because we want a separate plot for male and female . Let's run this. So so here we have two canvases. Let's put the data on these two canvases. So de dot map and we want history graph plt dog hissed and which column we want to put on a judge and that's run this stuff here. So now we have, ah, something similar to this plot. What is an other perimeter? He's splitting them based on alive? Yes and no. So let's pass in Hue here and read on this, sir. So here we have. So we have Hugh equals alive, which is splitting these two plots for yes and no. So one thing you know, this is playing with the transparency in this plot as well. If we know we can set the transparency using Alfa L for equal 2.5. Let's feed on this time. So here we have similar plot. The only thing is missing legit, and we know we can at legion using G daughter at legend. And if we don't descent here we have the same plot in the outfield. We're getting lots of information from these two plots were separating them for male and female. And then we're passing hue as alive. So moving forward, the clear deplored below use Titanic data set hint is much explored. He's asking for a heat map here, and we need to put these numbers on heat map Aspar. So if you remember for much explored your data should be in matrix form. And this is a correlation that the titanic dot core So we can call Correlation function on Titanic data and passing to the heat map of S and S start heat map as we can do all this thing in single line Titanic core and let's run this other. So here we have a very basic eat map. We need to play with some para meters. If you best shift top, you had an option for see map and a note. Let's pass and see map and and so see map. And this one is once again cool wall and and not equal to true and read on the set. And here we have the same heat map. Correlation off variable itself is always one which is along the diagonal towards that We're getting high correlation. Whereas towards blue we're getting lower correlation. So, guys, this was all about the C bonds exercise lecture. So we're done with the C bond section. Now. I hope you enjoyed this section. Let's move on to the next section where we're going to talk about pandas capabilities for did up, locking soon The next lecture. Good luck. 18. What next in class 4?: