我有一个150个值的条形图。
代码是:
rcParams.update({'figure.自动布局':真})
plt.图(尺寸=(14,9),dpi=600)
reso_names = [x[0] for x in resolution3]
reso_values = [x[1] for x in resolution3]
plt.bar(range(len(reso_values[0:20])), reso_values[0:20], align='center')
plt.xticks(range(len(reso_names[0:20])), list(reso_names[0:20]), rotation='vertical')
plt.margins(0.075)
plt.xlabel('Resolution Category Tier 3')
plt.ylabel('Volume')
plt.title('Resolution Category Tier 3 Volume', {'family' : 'Arial Black',
'weight' : 'bold',
'size' : 22})
plt.savefig('Reso3.pdf', format='pdf')
plt.show()
因为我想把它分成20个子图来保持可读性,所以我在reso_名称和reso_值处使用[0:20](两个列表)。
然而,问题是尺度不能被保持,每个子图有非常不同的尺度,这是一个没有保持一致性的问题。我如何设置一个可以在所有图形中保持的比例。在
您可以指定
sharey=True
以保持所有子批次中的y刻度相同。在或者,如果您希望单独打印它们,您可以手动配置
ax.set_ylim()
。在相关问题 更多 >
编程相关推荐