Matplotlib: How to change the location of names?

Viewed 26

I have a function that reads a CSV file and outputs it to graphs. His window looks like this

enter image description here

As you can see, the names of the graphs Filter and step2 are on the left and all the others are on the right. This does not suit me. Here is my function

def Grahp2():
    df = pd.read_csv('Dataset.csv',) 
    names = ['P', 'Filter', 'Answers', 'step','step2','Comulative', 'Delta_ema','ComulativePOC', 'Delta_P', 'Sum','SpeedUp', 'M' ]
    features = df[names]
    features.index = df['Time']
    axs = features.plot(subplots=True)
    cursor = MultiCursor(axs[1].get_figure().canvas, axs)
    plt.subplots_adjust(wspace=0.19, hspace=0.05, top=0.99, right=0.988, bottom=0.052, left=0.055)
    plt.show()

Is it possible just in my method to make sure that all the names are in one particular place?

1 Answers
def Grahp2():
    df = pd.read_csv('Датасет с дельтами ема.csv',) 
    names = ['P', 'Filter', 'Answers', 'step','step2','Comulative', 'Delta_ema','ComulativePOC', 'Delta_P', 'Sum','SpeedUp', 'M' ]
    features = df[names]
    features.index = df['Время']
    axs = features.plot(subplots=True)
    axs[0].legend(loc = 'upper right')
    axs[1].legend(loc = 'upper right')
    axs[2].legend(loc = 'upper right')
    axs[3].legend(loc = 'upper right')
    axs[4].legend(loc = 'upper right')
    axs[5].legend(loc = 'upper right')
    axs[6].legend(loc = 'upper right')
    axs[7].legend(loc = 'upper right')
    axs[8].legend(loc = 'upper right')
    axs[9].legend(loc = 'upper right')
    axs[10].legend(loc = 'upper right')
    axs[11].legend(loc = 'upper right')
    cursor = MultiCursor(axs[1].get_figure().canvas, axs)
    plt.subplots_adjust(wspace=0.19, hspace=0.05, top=1, right=1, bottom=0.045, left=0.033)
    plt.show()
Related