Page 115 - Informatics_Practices_Fliipbook_Class12
P. 115
Fig 3.13: Performance in a Noisy Room
You would notice that the performance of the students in the quiet room is superior to their performance in the
noisy room.
However, it would be much easier to observe this trend, if both the graphs are plotted in the same figure (Fig 3.14), as
illustrated below:
>>> import matplotlib.pyplot as plt
>>> timeSpentStudying = [1, 2, 3, 4, 5, 6]
>>> quietRoomScores = [63, 75, 82, 87, 93, 100]
>>> noisyRoomScores = [58, 62, 68, 69, 75, 80]
>>> plt.plot(timeSpentStudying, quietRoomScores, 'ro-')
>>> plt.plot(timeSpentStudying, noisyRoomScores, 'b<-')
>>> plt.xlabel('No of hours studied')
>>> plt.ylabel('Score')
>>> plt.title("Performance in a Noisy Room vs Quiet Room")
>>> plt.show()
Fig 3.14: Performance in a Noisy Room vs Quiet Room
Data Visualization 101

