I would like to have a function that adds plots to an existing chart when called. Right now my empty plot shows, but called the function never seems to happen as it waits until I close the chart window. The program then ends without reopening the chart window.
import numpy as np
import matplotlib.pyplot as plt
import time
fig, ax = plt.subplots()
plt.show()
def plotting(slope, intercept):
x_vals = np.array(ax.get_xlim())
y_vals = intercept + slope * x_vals
ax.plot(x_vals, y_vals, '-')
plt.show()
plotting(10,39)
time.sleep(1)
plotting(5,39)