Consider a matplotlib plot exported with a low DPI (dots per inch) setting. What is the most likely visible effect on the saved image?
import matplotlib.pyplot as plt plt.plot([1, 2, 3], [4, 5, 6]) plt.savefig('low_dpi_plot.png', dpi=50)
Think about what DPI controls in an image.
Low DPI means fewer dots per inch, so the image has less detail and looks blurry or pixelated when enlarged.
Given the following code snippets, which saved image will likely have the larger file size?
import matplotlib.pyplot as plt plt.plot([1, 2, 3], [4, 5, 6]) plt.savefig('plot.png', dpi=300) # High DPI plt.savefig('plot_low.png', dpi=50) # Low DPI
Higher DPI means more pixels to store.
Higher DPI images contain more pixels, increasing file size compared to lower DPI images.
Look at this code that exports a plot with dpi=300, but the saved image looks blurry. What is the most likely cause?
import matplotlib.pyplot as plt plt.plot([1, 2, 3], [4, 5, 6]) plt.savefig('plot.png', dpi=300) plt.show()
Think about how image viewers display images.
Zooming in on an image in a viewer can make even high DPI images appear blurry due to pixel enlargement.
Which is the main advantage of exporting plots as vector graphics (e.g., SVG, PDF) instead of raster images (e.g., PNG)?
Think about what happens when you zoom in on different image types.
Vector graphics use shapes and lines, so they can be scaled infinitely without blurring.
If you export a plot sized 6 inches wide and 4 inches tall at 200 DPI, how many total pixels does the image contain?
Calculate width_pixels = width_in_inches * DPI, height_pixels = height_in_inches * DPI, then multiply.
Width pixels = 6 * 200 = 1200, height pixels = 4 * 200 = 800, total pixels = 1200 * 800 = 960,000.