<jupyter_start><jupyter_text>Comparing the old and new controller<jupyter_code>for algorithm in old_metrics['PlanningAlgorithm'].unique():
    fig, axes = plt.subplots(1, 3, figsize=(40,10))
    # Determine plot data and associated parameters
    label_name=['Goal Number: '+str(num) for num in old_metrics['goalNumber'].unique()]
    width = 0.7/2
    x=old_metrics['goalNumber'].unique()

    metric = ['distanceTravelled','totalAngleTurned','timeForPath']

    for i in range(3):
        axes[i].bar(x-width/2,old_metrics[old_metrics['PlanningAlgorithm']==algorithm][metric[i]],width,label='old')
        axes[i].bar(x+width/2,new_metrics[new_metrics['PlanningAlgorithm']==algorithm][metric[i]],width,label='new')

        # Add title, axis labels and tick labels
        axes[i].set_ylabel(metric[i],fontsize=22,fontweight='bold')
        axes[i].set_xlabel('Goal Numbers',fontsize=22,fontweight='bold')
        axes[i].set_title(algorithm+' - '+metric[i],fontsize=24,fontweight='bold')
        axes[i].set_xticks(x)
        label_name=[textwrap.fill(name,10) for name in label_name]
        axes[i].set_xticklabels(label_name,fontsize=16)
        axes[i].legend(fontsize=18)
    alg_name = ''.join(c for c in '_'.join(algorithm.split()) if c.isalnum() or c=='_')   
    filename = '../report/images/compare_robot_'+alg_name +'.png'
    plt.savefig(filename)
    fig.tight_layout()
    plt.show()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup