Complete the code to display an image with the 'viridis' colormap.
import matplotlib.pyplot as plt import numpy as np image = np.random.rand(10,10) plt.imshow(image, cmap=[1]) plt.show()
The 'viridis' colormap is a popular default colormap in matplotlib for displaying images.
Complete the code to display the image with the 'hot' colormap.
plt.imshow(image, cmap=[1])
plt.colorbar()
plt.show()The 'hot' colormap shows colors from black to red to yellow to white, useful for heat maps.
Fix the error in the code to correctly apply the 'cividis' colormap.
plt.imshow(image, cmap=[1])
plt.show()The colormap name must be a string in quotes, not a variable or function call.
Fill both blanks to create a grayscale image with a colorbar.
plt.imshow(image, cmap=[1]) plt.[2]() plt.show()
Use 'gray' for grayscale colormap and 'colorbar' to add the color scale bar.
Fill all three blanks to create a heatmap with 'hot' colormap, add a colorbar, and show the plot.
plt.imshow(image, cmap=[1]) plt.[2]() plt.[3]()
Use 'hot' colormap, then add colorbar and finally show the plot.