Document (1) (3) - KSH
Document (1) (3) - KSH
January 1
PROGRAM
S 2025
Ans. Program:
import cv2
from matplotlib import pyplot as pit
import numpy as np
img= cv2.imread('D:\London.jpg')
plt.imshow(img)
Plecitier My Favourite City’
Plt.axis(‘off’)
Pit.show
Output:
18. Using Matplotlib and the given data, plot a bar chart
No of people voted (23.45.31.40.35)
Area covered = [‘al,a2, a3 a4 a51
Ans. Program:
Import matplotlib.pyplot as pit
No_of people voted – 123,45,31,40,351
Pit.bar(‘a’,’a’,’3’, ‘a’, ‘a’), No_of_people_voted)
Pit.title(‘Bar Chart”)
Plt.ylabel(‘No of people voted’)
Pit.show()
Output:
19. Using Matplotlib and the given data, plot a line chart:
X-axis [3,4,6,2,81
Y-axis
Ans. Program:
19,10,8,7,61
Import matplotlib.pyplot as pit
Import numpy as np
Xnp.array([3,4,6,2,8))
Ynp.array([9,10,8,7,611
Plt.plot(x, y)
Plt.show()
20. Using Matplotlib and the given data, Plot a pie chart:
Data (45,23,41,78,651
Ans. Program:
From matplotlib import pyplot as pit
Import numpy as np
Fig plt.figure()
Axfig.add_axes ((0,0,1,1])
Ax.axisf’equal’)
Data (45,23,41,78,651
Ax.pie (Data, autopot=’41.21%)
Pit.show()
Output: