Search⌘ K

Plot the Arrays

Explore how to plot and visualize two-dimensional arrays in Python using the matplotlib library. Understand the use of the imshow() function to turn numeric data into colored visual formats, enabling easier data interpretation and analysis. This lesson helps you gain practical skills in creating basic graphical representations of array data in machine learning contexts.

We'll cover the following...

Use of matplotlib

Just like large tables or lists of numbers, looking at large arrays isn’t that helpful. Visualizing them helps us quickly get an idea of the general meaning. One way of plotting two-dimensional arrays of numbers is to think of them as flat two-dimensional surfaces, colored according to the value at each cell in the array. We can choose how we turn a value inside a cell into a color. We might choose to simply turn the value into a color according to a color scale, or we might color everything white except for values above a certain threshold that would be black.

Coding example

Let’s try plotting the small ...