0

I tried using interactive mode but when the program gets to plt.show() it just shows a loading white screen which closes after the time.sleep() has passed.

This is the code with the interactive mode:

import numpy as np
import random as rand
import time as t
import matplotlib.pyplot as plt
plt.ion()

grid = np.zeros((20,20))

# Here a random grid is generated with a Monte Carlo method

while True:
    # with each step the grid array gets updated
    plt.imshow(grid)
    plt.show()
    t.sleep(0.5)
    plt.close()

I am just a beginner with Python and matplotlib so I would like to keep things as simple as possible.

0 Answers0