Introduction To Matplotlib-Python

Matplotlib

Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. 











import pandas as pd

  dict1= {
        "Name":["sid","Rohit","Anil","Vyas","Ankit","raju","daju","ben","Kaju","divya","seeta","geeta","Ram","Shyam"],
     
        "Course":['B.tech','B.com','MCA','MA','BA',"Bpharma",'M.COM','B.com','B.Tech','B.Tech','Mass.com','BA','MA','M.Tech'],
        "Marks":[97,87,81,88,67,87,98,90,76,56,56,77,88,88]

                   
         }

df=pd.DataFrame(dict1)

df=df.style.hide_index()

import matplotlib.pyplot as plt
%matplotlib inline

plt.plot();

x=[1,2,3,4,5]
y=[11,22,33,4,55]
plt.plot(x,y)
type(fig),type(ax)

martdata=pd.read_csv("trainmartcsv")
martdata.shape
heartdata=pd.read_csv("heart.csv")
heartdata.head()

heartdata.shape

fig,ax=plt.subplots(figsize=(10,10))

x=[1,2,3,4,5]
y=[11,22,33,4,55]

fig,ax=plt.subplots(figsize=(10,10))
x=[1,2,3,4,5]
y=[11,22,33,44,55]
ax.plot(x,y)
ax.set(title="Simple Plot",xlabel="x-axis",ylabel="y-axis")

import numpy as np

x=np.linspace(0,10,100)

x[:10]

fig,ax=plt.subplots()
ax.plot(x,x**3);

fig,ax=plt.subplots()
ax.scatter(x,x**5)

nut_butter_prices={"Almond":8,
                   "Peanut":5,
                   "Cashew":12}
fig,ax=plt.subplots()
ax.bar(nut_butter_prices.keys(),nut_butter_prices.values())
ax.set(title="Nut_Butter_Prices",xlabel="x-axis",ylabel="Price($)");

fig,ax=plt.subplots()
ax.barh(list(nut_butter_prices.keys()),list(nut_butter_prices.values()));

x=np.random.randn(1000)
fig,ax=plt.subplots()
ax.hist(x);

fig,((ax1,ax2),(ax3,ax4))=plt.subplots(nrows=2,ncols=2,figsize=(10,5))

#Lets Plot data on each plot
ax1.plot(x,x);
ax2.scatter(np.random.random(10),np.random.random(10));
ax3.bar(nut_butter_prices.keys(),nut_butter_prices.values())

fig,ax=plt.subplots(nrows=2,
                   ncols=2,
                   figsize=(10,5))

carsales=pd.read_csv("car_sales.csv")








Comments

Popular posts from this blog

Top 5 Best Books For Python,Data Science & Machine Learning

How To Start A BLOG

Top 50 Most Innovative Companies in 2020

Blogger Tutorial

Normal Distribution

Descriptive Statistics

What is A Statistical Distribution?

Why Should We learn C Programming?

Pandas-Python Tutorials