Q. Marks of some students in four different subjects are available in four lists. Write a program to plot this data in a filled horizontal box-plot.


Answer :-

import matplotlib.pyplot as plt

Marks1 = [82, 76, 24, 40, 67, 62, 75, 78,\
          71, 32, 98, 89, 78, 67, 72, 82, 87, 66, 56, 52]
Marks2 = [62, 5, 91, 25, 36, 32, 96, 95, 3,\
          90, 95, 32, 27, 55, 100, 15, 71, 11, 37, 21]
Marks3 = [23, 89, 12, 78, 72, 89, 25, 69, 68,\
          86, 19, 49, 15, 16, 16, 75, 65, 31, 25, 52]
Marks4 = [59, 73, 70, 16, 81, 61, 88, 98, 10,\
          87, 29,72, 16, 23, 72, 88, 78, 99,75, 30]

Mks_data = [Marks1, Marks2, Marks3, Marks4]
plt.boxplot ( Mks_data, vert = 0, patch_artist = True,
              labels = ['Eng', 'Eco', 'Bus.Stud', 'I.P.'])
plt.show()


Output :-

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post