def plot_bars(list_axis_data): figwidth = 20 fig = plt.figure(figsize=(figwidth, figwidth * 9 / 16)) plt.title(opt.title, fontsize=24) plt.xlabel(opt.xlabel, fontsize=20) plt.ylabel(opt.ylabel, fontsize=20) plt.grid(True, axis='y') ax0 = fig.axes[0] width = 0.45 for i, (axis, data) in enumerate(list_axis_data): axis, data = sort2list(axis, data) barcont = plt.bar(np.arange(len(axis)) + width * i, data, width, tick_label=axis, label=opt.legend[i]) autolabel(barcont, ax0, data, fontsize=14) for l in ax0.xaxis.get_ticklabels(): if opt.vertical_x: l.set_rotation('vertical') l.set_fontsize(16) for l in ax0.yaxis.get_ticklabels(): l.set_fontsize(16) ax0.set_xticks(np.arange(len(axis)) + width / 2) ax0.autoscale(True, 'x', True) plt.legend(prop={'size': 16}) plt.savefig(opt.savename) plt.close(fig)
def plot_lines(list_axis_data): figwidth = 20 fig = plt.figure(figsize=(figwidth,figwidth*9/16)) plt.title(opt.title, fontsize=24) plt.xlabel(opt.xlabel, fontsize=20) plt.ylabel(opt.ylabel, fontsize=20) plt.grid(True) ax0 = fig.axes[0] for i, (axis, data) in enumerate(list_axis_data): axis, data = sort2list(axis, data) plt.scatter(axis, data) plt.plot(axis, data, label=opt.legend[i]) for l in ax0.xaxis.get_ticklabels(): if opt.vertical_x: l.set_rotation('vertical') l.set_fontsize(16) for l in ax0.yaxis.get_ticklabels(): l.set_fontsize(16) ax0.autoscale(True,'x',True) ax0.autoscale(True,'y',True) plt.legend(prop={'size':16}) plt.savefig(opt.savename) plt.close(fig)
l.set_rotation('vertical') l.set_fontsize(11) for l in ax0.yaxis.get_ticklabels(): l.set_fontsize(11) ax0.autoscale(True,'x',True) ax0.autoscale(True,'y',True) plt.plot(axis, data) plt.tight_layout() plt.savefig(path.join(opt.save_dir,"avg_ssim_size.jpg")) plt.close(fig) save_stc(path.join(opt.save_dir,"avg_ssim_size.txt"), axis, data) # Display ssim_count # axis, data = sort2list(list(ssim_count.keys()), list(ssim_count.values())) figwidth = 20 fig = plt.figure(figsize=(figwidth,figwidth*9/16)) plt.title("Số lượng ảnh theo chỉ số SSIM", y=1.01, fontsize=24) plt.xlabel("SSIM", fontsize=20) plt.ylabel("Số lượng ảnh", fontsize=20) plt.scatter(axis, data) plt.grid(True) ax0 = fig.axes[0] for l in ax0.xaxis.get_ticklabels(): l.set_fontsize(16) for l in ax0.yaxis.get_ticklabels(): l.set_fontsize(16) ax0.autoscale(True,'x',True) ax0.autoscale(True,'y',True) plt.plot(axis, data)