A figure can also be saved by using __________ function in Python.
A figure can also be saved by using __________ function in Python.
Solution
✅ Correct Option: 2
In Matplotlib, the savefig() function from pyplot saves the current figure to a file, for example plt.savefig("chart.png"). The file format (png, pdf, jpg, etc.) is taken from the file extension.
Call savefig() before show(), because show() can clear the figure and leave a blank saved file.
Option 1: plot() only draws the line graph and does not save anything.
Options 3 and 4: graph() and savegraph() do not exist in Matplotlib.
Related questions:
2025: 3 June Shift 2
2026: 29 May Shift 1