<jupyter_start><jupyter_text>Installing Required Libraries Let's see which libraries are required to plot graphs in Seaborn. Make sure you install following libraries to proceed further.1. Pandas2. Matplotlib3. Seaborn<jupyter_code>#IMPORTING LIBRARIES
import pandas as pd #for loading datasets
from matplotlib import pyplot as plt #for customisation
%matplotlib inline
# Seaborn for plotting and styling
import seaborn as sns<jupyter_output><empty_output><jupyter_text>1. Implot ‘lmplot’ is the most basic plot which shows a line along a 2-dimensional plane and is used to see the correlation between two attributes plotted against the x-axis and y-axis. Here we are considering two variables Applicant income and Loan Amount. Seaborn also allows you to set the height, colour palette, etc. properties for the plot generated.<jupyter_code>#importing the dataset
df=pd.read_csv('Loan Prediction Dataset.csv')
df.head
#WITHOUT FITTING LINEAR REGRESSION
sns.lmplot(x='ApplicantIncome', y='LoanAmount', data=df,
           fit_reg=False, # No regression line
          )
#WITH FITTING LINEAR REGRESSION
sns.lmplot(x='ApplicantIncome', y='LoanAmount', data=df,
           fit_reg=True, #  regression line
          )<jupyter_output><empty_output><jupyter_text>2. Barplot A barplot is basically used to aggregate the categorical data according to some methods and by default it’s the mean. It can also be understood as a visualization of the group by action. To use this plot we choose a categorical column for the x-axis and a numerical column for the y-axis, and we see that it creates a plot taking a mean per categorical column.<jupyter_code>#Plotting Applicant income and loan status to see if applicant income affects his loan status
sns.barplot(x ='Loan_Status', y ='ApplicantIncome', data = df)<jupyter_output><empty_output><jupyter_text>3. Count Plot A countplot basically counts the categories and returns a count of their occurrences. It is one of the simplest plots provided by the seaborn library<jupyter_code>#Plotting Loan status to count people with acceptance and rejection of Loan
sns.countplot(x ='Loan_Status', data = df) #Y= yes, N=no<jupyter_output><empty_output><jupyter_text>4. Box Plot Box Plot is the visual representation of the depicting groups of numerical data through their quartiles. Boxplot is also used to detect the outlier in the data set.<jupyter_code>sns.boxplot(x='Property_Area', y='ApplicantIncome', data=df)<jupyter_output><empty_output><jupyter_text>5. KDE Plot A Kernel Density Estimate plot is used to visualize the Probability density distribution of univariate data. In simple terms, we can use it to know the spread/distribution of the data.<jupyter_code>sns.kdeplot(df['ApplicantIncome'])<jupyter_output><empty_output><jupyter_text>6.Dist Plot Distplot is the most convenient way of visualizing the distribution of the dataset and the skewness of the data. It is a combination of kdeplot and histograms.<jupyter_code>sns.distplot(df['ApplicantIncome'])<jupyter_output><empty_output><jupyter_text>7. HeatMap Heatmaps are used to display the correlations of different numerical attributes in a dataset. In heatmaps, colour scheme plays an important role in visualizing whether the relationship is positive or negative. For creating a heatmap we will create a Correlation matrix and pass it to the heatmap parameter. We will also set the annotation to true so the value of the relationship is also visible.<jupyter_code>sns.heatmap(df.corr(), annot=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.062127659574468086, 'fraction_numerical': 0.003120567375886525, 'mean_word_length': 5.690702087286527, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '361411', 'license': 'MIT', 'n_tokens_mistral': 1038, 'n_tokens_neox': 985, 'n_words': 430, 'path': 'Graphs for Visualisation/Graphs in Seaborn(Data Visualisation).ipynb', 'repo_name': 'akrish4/datascience-mashup', 'size': '3525'}