0

This is my code:

def plot_and_store(df,method_name):
    '''
    Plots the given time indexed data frame and stores the plots in the folder
    '''
    for i in range(1,8):
        column_name = "T"+str(i) + "_FWD"
        series = df[column_name]
        plot = series.plot()
        figure_for_saving = plot.get_figure()
        figure_for_saving.savefig(root+"stat_plots/"+column_name+method_name)
        plot.
    return

I am using pandas to plot the columns in the series. However on each iteration, I get the plot of the previous column plus the new one. I am wondering how to clear the plot each time.

IAQ
  • 29
  • 4

1 Answers1

0

From another question:

    cla()   # Clear axis
    clf()   # Clear figure
    close() # Close a figure window

When to use cla(), clf() or close() for clearing a plot in matplotlib?

KillerToilet
  • 196
  • 9