Complete the code to save the plot as a PNG file named 'plot.png'.
import matplotlib.pyplot as plt plt.plot([1, 2, 3], [4, 5, 6]) plt.[1]('plot.png')
The savefig function saves the current figure to a file. Here, it saves as 'plot.png'.
Complete the code to save the plot as an SVG file named 'image.svg'.
import matplotlib.pyplot as plt plt.plot([10, 20, 30], [1, 4, 9]) plt.[1]('image.svg')
Use savefig to save the plot as an SVG file by specifying the filename with '.svg' extension.
Fix the error in the code to save the plot as a PDF file named 'chart.pdf'.
import matplotlib.pyplot as plt plt.plot([5, 6, 7], [8, 9, 10]) plt.[1]('chart.pdf')
The correct function to save a figure is savefig, not save.
Fill both blanks to save the plot as a PNG file with 300 dpi resolution.
import matplotlib.pyplot as plt plt.plot([1, 3, 5], [2, 4, 6]) plt.[1]('high_res.png', dpi=[2])
Use savefig to save the plot and set dpi=300 for high resolution.
Fill all three blanks to save the plot as a PDF file with transparent background and tight bounding box.
import matplotlib.pyplot as plt plt.plot([2, 4, 6], [1, 3, 5]) plt.[1]('output.pdf', transparent=[2], bbox_inches=[3])
Use savefig with transparent=True and bbox_inches='tight' to save a PDF with a transparent background and no extra whitespace.