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)
Beispiel #2
0
plt.close(fig)

save_stc(path.join(opt.save_dir,"ssim_count.txt"), axis, data)

# Display avg_ssim_char
#
axis, data = sort2list(list(avg_ssim_char.keys()), list(avg_ssim_char.values()))
figwidth = 20
fig = plt.figure(figsize=(figwidth,figwidth*9/16))
plt.title("Chỉ số SSIM trung bình theo mỗi ký tự", y=1.01, fontsize=24)
plt.xlabel("Ký tự", fontsize=20)
plt.ylabel("Chỉ số SSIM trung bình", fontsize=20)
plt.grid(True,axis='y')
ax0 = fig.axes[0]
barcont = plt.bar(np.arange(len(axis)),data,tick_label=axis)
autolabel(barcont, ax0, data, fontsize=14)
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)
plt.savefig(path.join(opt.save_dir,"avg_ssim_char.jpg"))
plt.close(fig)

save_stc(path.join(opt.save_dir,"avg_ssim_char.txt"), axis, data)

# Display ssimT_char_count
#
axis, data = sort2list(list(ssimT_char_count.keys()), list(ssimT_char_count.values()))
figwidth = 20
fig = plt.figure(figsize=(figwidth,figwidth*9/16))