# -*- coding: utf-8 -*-
"""
Created on Tue Feb 15 21:56:03 2022

@author: TANISH
"""


""" List Of Charts Covered """
# Bar Plot
# Box Plot
# Scatter Plot
# Multiple Bar Chart
# Histogram
# Kernal Density Plot
# Pair(s) Plot


import seaborn as sb
import pandas as pd

mtcars = pd.read_csv(r"C:/Users/tanis/Desktop/MTCARS.csv")
mtcars.rename(columns = {"Unnamed: 0" : "CarName"},
                                      inplace = True)



# Identify the relationship(s) among the data set
sb.heatmap(mtcars.corr())

sb.heatmap(mtcars.corr(),annot = True)
sb.heatmap(mtcars.corr(),annot = True,linewidths = 1)


# Q.) What proportion of the cars in the market
#     are Auto?

# Pie Chart

import matplotlib.pyplot as plt

tab = mtcars["am"].value_counts()
plt.pie(tab.values,labels = tab.index,
        autopct = "%0.0f%%")


# Q.) Identify the variability across variables
#     and their Distribution?

# Violin Plot

sb.violinplot(data = mtcars,x = "cyl",y = "mpg")

sb.kdeplot("mpg",shade = True,
                  hue = "cyl",data = mtcars)

sb.violinplot(data = mtcars,x = "cyl",y = "mpg",
              hue = "am",split = True)



# Strip Plot
sb.stripplot(x = "cyl",y = "mpg",data = mtcars,
             jitter = False)

sb.stripplot(x = "cyl",y = "mpg",data = mtcars)

sb.histplot(mtcars[mtcars["cyl"] == 8]["mpg"])



# Swarm Plot
sb.violinplot(data = mtcars,x = "cyl",y = "mpg")

sb.swarmplot(x = "cyl",y = "mpg",data = mtcars,
             color = "black")


# Setting xlim, ylim
dummy = sb.histplot(mtcars["mpg"],
            kde = True)

dummy.set_xlim(0,100)
dummy.set_ylim(0,100)



# Setting axis labels
sb.displot(mtcars["mpg"],kind = "hist",
           color = "skyblue").set(xlabel = "MPG", 
                                ylabel = "Freq",
                                title = "Histogram of MPG")

                                  
                                                                    
# Palette In Seaborn

plt.pie(tab.values,labels = tab.index,
        autopct = "%0.0f%%",
        colors = sb.color_palette("Paired"))


sb.kdeplot("mpg",shade = True,
                  hue = "cyl",data = mtcars,
                  palette = sb.color_palette("Paired")[1:4])


# Website:
# https://matplotlib.org/2.0.2/examples/color/named_colors.html
