def METHOD_NAME(x, Pflat, testName, show_plots):
    numStates = len(x[0,:])-1
    P = np.zeros([len(Pflat[:,0]),numStates,numStates])
    t= np.zeros(len(Pflat[:,0]))
    for i in range(len(Pflat[:,0])):
        t[i] = x[i, 0]*1E-9
        P[i,:,:] = Pflat[i,1:(numStates*numStates+1)].reshape([numStates,numStates])
    plt.figure(num=None, figsize=(10, 10), dpi=80, facecolor='w', edgecolor='k')
    plt.subplot(321)
    plt.plot(t , x[:, 1], "b", label='Error Filter')
    plt.plot(t , x[:, 1]+3 * np.sqrt(P[:, 0, 0]), 'r--',  label='Covar Filter')
    plt.plot(t , x[:, 1]-3 * np.sqrt(P[:, 0, 0]), 'r--')
    plt.legend(loc='lower right')
    plt.title('First pos component (m)')
    plt.grid()
    plt.subplot(322)
    plt.plot(t , x[:, 4], "b")
    plt.plot(t , x[:, 4]+3 * np.sqrt(P[:, 3, 3]), 'r--')
    plt.plot(t , x[:, 4]-3 * np.sqrt(P[:, 3, 3]), 'r--')
    plt.title('Second rate component (m/s)')
    plt.grid()
    plt.subplot(323)
    plt.plot(t , x[:, 2], "b")
    plt.plot(t , x[:, 2]+3 * np.sqrt(P[:, 1, 1]), 'r--')
    plt.plot(t , x[:, 2]-3 * np.sqrt(P[:, 1, 1]), 'r--')
    plt.title('Second pos component (m)')
    plt.grid()
    plt.subplot(324)
    plt.plot(t , x[:, 5], "b")
    plt.plot(t , x[:, 5]+3 * np.sqrt(P[:, 4, 4]), 'r--')
    plt.plot(t , x[:, 5]-3 * np.sqrt(P[:, 4, 4]), 'r--')
    plt.xlabel('t(s)')
    plt.title('Third rate component (m/s)')
    plt.grid()
    plt.subplot(325)
    plt.plot(t , x[:, 3], "b")
    plt.plot(t , x[:, 3]+3 * np.sqrt(P[:, 2, 2]), 'r--')
    plt.plot(t , x[:, 3]-3 * np.sqrt(P[:, 2, 2]), 'r--')
    plt.xlabel('t(s)')
    plt.title('Third pos component (m)')
    plt.grid()
    plt.subplot(326)
    plt.plot(t , x[:, 6], "b")
    plt.plot(t , x[:, 6]+3 * np.sqrt(P[:, 5, 5]), 'r--')
    plt.plot(t , x[:, 6]-3 * np.sqrt(P[:, 5, 5]), 'r--')
    plt.xlabel('t(s)')
    plt.title('Third rate component (m/s)')
    plt.grid()
    unitTestSupport.writeFigureLaTeX('StatesPlot' + testName, 'State error and covariance', plt, 'height=0.9\\textwidth, keepaspectratio', path)
    if show_plots:
        plt.show()
    plt.close()