How to plot a 2d array with Matplotlib in Python

Plotting a 2d array creates a Matplotlib image that represents the values in the array as colors.

Solution for How to plot a 2d array with Matplotlib in Python : You can use matplotlib.pyplot.imshow() to plot a 2d array Call matplotlib.pyplot.imshow(X) with X set to a 2d array to plot the array. Use matplotlib.pyplot.show() to display the plot.


how-to-plot-a-2d-array-with-matplotlib-in-python