0% found this document useful (0 votes)
2 views3 pages

Maths Assignment

The document contains multiple Python code snippets that utilize the Matplotlib library to create various types of visualizations. These include bar charts for expenditures, subject scores, student participation in games, and air quality indices, as well as a pie chart for crop distribution and line plots for comparative data. Each visualization is labeled appropriately for clarity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Maths Assignment

The document contains multiple Python code snippets that utilize the Matplotlib library to create various types of visualizations. These include bar charts for expenditures, subject scores, student participation in games, and air quality indices, as well as a pie chart for crop distribution and line plots for comparative data. Each visualization is labeled appropriately for clarity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

import numpy as np

import matplotlib.pyplot as plt

data = {'Clothing':600, 'Food':4000, 'Rent':2000,

'Petrol':1500, 'Misc':700}

items = list(data.keys())

values = list(data.values())

fig = plt.figure(figsize = (10, 5))

plt.bar(items, values, color ='GREEN')

plt.xlabel("ITEMS")

plt.ylabel("EXPENDITURE IN RS.")

plt.show()

--------------------------------------------------------------------------------------------------------
------

import numpy as np

import matplotlib.pyplot as plt

data = {'Maths':68, 'Science':90, 'English':70,

'Marathi':85, 'Hindi':91}

items = list(data.keys())

values = list(data.values())

fig = plt.figure(figsize = (10, 5))

plt.bar(items, values, color ='GREEN')

plt.xlabel("Subject")

plt.ylabel("Percentage of passing")

plt.show()
--------------------------------------------------------------------------------------------------------
------

import numpy as np

import matplotlib.pyplot as plt

data = {'Cricket':65, 'Football':30, 'Hockey':54,

'Chess':10, 'Tennis':20}

items = list(data.keys())

values = list(data.values())

fig = plt.figure(figsize = (10, 5))

plt.bar(items, values, color='GREEN', width=0.7)

plt.xlabel("Game")

plt.ylabel("Number of students")

plt.show()

--------------------------------------------------------------------------------------------------------
------

import numpy as np

import matplotlib.pyplot as plt

data = {'Pune':168, 'Mumbai':190, 'Nashik':170,

'Nagpur':178, 'Thane':195}

items = list(data.keys())

values = list(data.values())

fig = plt.figure(figsize = (10, 5))

plt.barh(items, values, color='MAROON')

plt.xlabel("City")

plt.ylabel("Air Quality Index")

plt.show()
--------------------------------------------------------------------------------------------------------
------

import matplotlib.pyplot as plt

labels = 'Wheat', 'Bajra', 'Rice', 'Maize','Jawar','Others'

sizes = [23, 25, 22, 15, 11, 4]

fig, ax = plt.subplots()

ax.pie(sizes,labels=labels, autopct='%1.1f%%')

import matplotlib.pyplot as plt

t1=[5,7,6]

t2=[4,4,6]

r1=[2,10,10,2]

r2=[2,2,8,8]

p1=[6,10,8,4,2]

p2=[2,4,7,8,4]

i1=[0,4,2]

i2=[0,0,4]

plt.plot(t1,t2,color='GREEN')

plt.plot(r1,r2,color='BLUE')

plt.plot(p1,p2,color='RED')

plt.plot(i1,i2,color='black')

plt.xlabel("x-axis")

plt.ylabel("y-axis")

plt.show()

You might also like