0

如何调整 x 轴和第一个水平条之间的空间。默认情况下,x 轴和绘制的第一个水平条之间有很大的空间。

这是我的示例代码:

    hbar_fig = plt.figure()
    ax3 = plt.subplot(111)
    ax3.barh(y_pos, data, self.hbar_width, align='center', color='#0073cf', edgecolor='#0073cf')
    matplotlib.pyplot.gcf().set_size_inches(10, len(data) * 1)
    ax3.set_xlim(0, max(data) + 1)
    plt.grid(b=True, color=self.x_grid_line_color, linestyle='-')
    plt.yticks(y_pos, map((lambda x, y: x + ' - ' + str(y)), app_data.keys(), app_data.values()), weight=self.x_font_weight, fontsize=9)
    plt.tick_params(axis='y', direction='out', pad=12)
    plt.tight_layout()
    hchart_buffer.close()
    plt.close(hbar_fig)
4

0 回答 0