Medium
A Heatmap With imshow
Read r rows of numbers and a colour map name. Draw
ax.imshow(grid, cmap=…) and add fig.colorbar(im). Print the shape of im.get_array(), the colour map's name and how many axes the figure now has.Input
r, the rows, then a cmap name.
Output
Three lines.
Sample 1
Input
2 1 2 3 4 5 6 viridis
Output
(2, 3) viridis 2
Sample 2
Input
1 5 Blues
Output
(1, 1) Blues 2
Output appears here