matplotlib: generate a new graph in a new window for subsequent program runs
Question: I have a Python program that generates graphs using matplotlib. I am trying to
get the program to generate a bunch of plots in one program run (the user is
asked if they want to generate another graph) all in separate windows. Any way
I can do this?


Answer: To generate a new figure, you can add plt.figure() before any plotting that
your program does.

    
    
    import matplotlib.pyplot as plt
    import numpy as np
    
    def make_plot(slope):
        x = np.arange(1,10)
        y = slope*x+3
        plt.figure()
        plt.plot(x,y)
    
    make_plot(2)
    make_plot(3)
    

