CBSE Class 12 Informatics Practices Question 125 of 147

Plotting with Pyplot — Question 8

Back to all questions
8
Question

Question 6

Consider the following graph. Write the Python code to plot it. Also add the Title, label for X and Y axis.

Consider the following graph. Write the Python code to plot it. Also add the Title, label for X and Y axis. Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

Using the following data for plotting the graph

smarks = [10, 40, 30, 60, 55]
sname = ["Sahil", "Deepak", "Anil", "Ravi", "Riti"]
Answer
import matplotlib.pyplot as plt
smarks = [10, 40, 30, 60, 55]
sname = ["Sahil", "Deepak", "Anil", "Ravi", "Riti"]
plt.plot(sname, smarks)
plt.xlabel('Student Name')
plt.ylabel('Marks Scored')
plt.title('Marks Secured by Students in Term-1')
plt.show()
Output
Consider the following graph. Write the Python code to plot it. Also add the Title, label for X and Y axis. Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12