<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Plotting Matrices
At some point you may need to plot a matrix. This works a bit differently from regular plots.
Step1:  In the plot above each cell of the matrix corresponds to one of the coloured grids, with the colour indicating the cell value.
Step2:  It's possible to smooth the plot by utilizing interpolation. This isn't something that I would recommend though as it hides the structure of your data. Note however that this USED to be the default behaviour of the implot function in earlier versions of Matplotlib.
Increasing the sampling density is a better way of generating a nicer plot.
Step3:  The color scale used to represent the data can also be modified using the cmap keyword argument.
Step4:  There are lots of different colormaps to choose from.
<ASSISTANT_TASK:>
Python Code:
def create_matrix(size):
    mat = np.zeros((size, size))
    for i in range(size):
        for j in range (size):
            mat[i, j] = i * j
    return mat
create_matrix(4)
mat = create_matrix(20)
plt.imshow(mat)
plt.colorbar() # Adds a colorbar to the plot to aid in interpretation.
plt.xlabel("x")
plt.ylabel("y")
plt.title("Matrix Plot")
Explanation: Plotting Matrices
At some point you may need to plot a matrix. This works a bit differently from regular plots.
End of explanation
mat = create_matrix(20)
plt.imshow(mat, interpolation="spline16")
plt.colorbar() 
plt.xlabel("x")
plt.ylabel("y")
plt.title("Matrix Plot")
Explanation: In the plot above each cell of the matrix corresponds to one of the coloured grids, with the colour indicating the cell value.
End of explanation
mat = create_matrix(60)
plt.imshow(mat)
plt.colorbar()
plt.xlabel("x")
plt.ylabel("y")
plt.title("Denser Matrix Plot")
Explanation: It's possible to smooth the plot by utilizing interpolation. This isn't something that I would recommend though as it hides the structure of your data. Note however that this USED to be the default behaviour of the implot function in earlier versions of Matplotlib.
Increasing the sampling density is a better way of generating a nicer plot.
End of explanation
import matplotlib.cm as cm
plt.imshow(mat, cmap=cm.Reds)
plt.colorbar()
plt.xlabel("x")
plt.ylabel("y")
plt.title("Switching Color Scale ")
Explanation: The color scale used to represent the data can also be modified using the cmap keyword argument.
End of explanation
plt.imshow(mat, cmap=cm.winter_r)
plt.colorbar()
plt.xlabel("x")
plt.ylabel("y")
plt.title("Switching Color Scale ")
Explanation: There are lots of different colormaps to choose from.
End of explanation
<END_TASK>