Here is an explanation of how this code works:
- img = plt.imread('bird_small.png') reads the image into a NumPy array, which is understood by Matplotlib.
- To avoid repeating the code for each plot, we defined a plot function that plots a graph for a given set of parameters.
- ax.xaxis.set_major_locator(MultipleLocator(25) sets ticks at intervals of 25 on the x axis. We repeat the same for the y axis as well.
- In figure 1, first row, we plot using the default parameters of origin and extent, then with origin='upper' and origin='lower' using the default for the extent parameter. Please note that the default and origin='upper' are the same. When origin='lower' is used, the image turns upside down, because the y co-ordinates change ...