How to output the full time using as = feature.plot(subheadings=True) or speed up the loading of graphs via fig, (ax1, ax2....) = plt.subheadings(N)

Viewed 16

I have two functions for displaying graphs and both of them generally work, but there are flaws in both of them.

The first function does not show the full time, which is very important to me. This is the first question - how to fully deduce time using this method of graph output.

def Grahp2():
    df = pd.read_csv('Data.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.show()

This function works fast and well, the x-axis is always not fully visible, so it is difficult to track changes in the charts and their timeline

The second function shows the full time on the x axis, but it takes a very very long time to load

def Grahp():
    PI = pd.read_csv('Датасет с дельтами ема.csv')
    x = PI['Time']
    y = PI['P']#
    x1 = PI['Time']
    y1 = PI['Filter']#
    x2 = PI['Time']
    y2 = PI['Answers']#
    x3 = PI['Time']
    y3 = PI['step']#
    x4 = PI['Time']
    y4 = PI['step2']#
    x5 = PI['Time']
    y5 = PI['Comulative']#
    x6 = PI['Time']
    y6 = PI['Delta_ema']#
    x7 = PI['Time']
    y7 = PI['ComulativePOC']#
    x8 = PI['Time']
    y8 = PI['Delta_P']#
    x9 = PI['Time']
    y9 = PI['Sum']
    x10 = PI['Time']
    y10 = PI['SpeedUp']
    x11 = PI['Time']
    y11 = PI['M']
    plt.rcParams['axes.facecolor'] = 'black'

    fig, (ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9, ax10, ax11, ax12) = plt.subplots(12)
    fig.suptitle('Графики')
    ax1.plot(x, y, color = 'yellow')
    ax1.set_title('(P)')
    #ax1.grid(linewidth= 0.1)
    ax1.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax2.plot(x1, y1, color = 'yellow')
    ax2.set_title('Filter')
    #ax2.grid(linewidth= 0.1)
    ax2.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax3.plot(x2, y2, color = 'yellow')
    ax3.set_title('Answer')
    #ax3.grid(linewidth= 0.1)
    ax3.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax4.plot(x3, y3, color = 'yellow')
    ax4.set_title('Step')
    #ax4.grid(linewidth= 0.1)
    ax4.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax5.plot(x4, y4, color = 'yellow')
    ax5.set_title('Step2')
    #ax5.grid(linewidth= 0.1)
    ax5.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax6.plot(x5, y5, color = 'yellow')
    ax6.set_title('Comulative')
    #ax6.grid(linewidth= 0.1)
    ax6.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax7.plot(x6, y6, color = 'yellow')
    ax7.set_title('Delta_ema')
    #ax7.grid(linewidth= 0.1)
    ax7.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax8.plot(x7, y7, color = 'yellow')
    ax8.set_title('ComulativePOC')
    #ax8.grid(linewidth= 0.1)
    ax8.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax9.plot(x8, y8, color = 'yellow')
    ax9.set_title('Delta_P')
    #ax9.grid(linewidth= 0.1)
    ax9.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax10.plot(x9, y9, color = 'yellow')
    ax10.set_title('Sum')
    #ax10.grid(linewidth= 0.1)
    ax10.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax11.plot(x10, y10, color = 'yellow')
    ax11.set_title('SpeedUp')
    #ax11.grid(linewidth= 0.1)
    ax11.tick_params(axis='x', labelrotation = 45, labelsize=5)
    ax12.plot(x11, y11, color = 'yellow')
    ax12.set_title('M')
    #ax12.grid(linewidth= 0.1)
    ax12.tick_params(axis='x', labelrotation = 45, labelsize=5)
    cursor = MultiCursor(fig.canvas, (ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9, ax10, ax11, ax12), color='r',
                     lw=1,  vertOn=True)
    plt.show()

How can I improve at least one of these features? Either output a complete list of time along the x axis in the first, or speed up the processing of the second.

0 Answers
Related