i want to create a visualization using pythons matplotlib library, specifically the imshow() function to represent a level. in python

main.py
import matplotlib.pyplot as plt
import numpy as np

# Create a 2D numpy array representing the level
level = np.array([
    [0, 1, 0, 1, 0],
    [1, 1, 1, 1, 1],
    [0, 1, 0, 1, 0],
    [1, 1, 1, 1, 1],
    [0, 1, 0, 1, 0]
])

# Display the level using imshow function
plt.imshow(level, cmap='binary', interpolation='nearest')
plt.axis('off')  # Turn off axes
plt.show()
372 chars
17 lines

gistlibby LogSnag