CBSE Class 12 Informatics Practices Question 5 of 73

Data Visualization using Matplotlib — Question 5

Back to all questions
5
Question

Question 5

Assertion (A): legend (labels = ['Text']) is used to give title to the graph.

Reasoning (R): plt.savefig("path") will save the current graph in png or jpeg format.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
Answer

A is false but R is true.

Explanation
The statement legend(labels=['Text']) is used to add a legend to the graph, not a title. The title of the graph is set using plt.title('Title Text'). The statement plt.savefig("path") saves the current graph to the specified path in PNG or JPEG format.