我创建与matplotlib-0.91(首次)的条形图而y轴标签被切断。如果我提高该图的宽度足够他们最终显示完全但随后的输出不正确的大小。

任何的方式来处理此?

有帮助吗?

解决方案

我想我遇到了一个类似的问题。

请参阅如果这有助于调整标签的字体大小:

import matplotlib.pyplot as plt
import matplotlib.font_manager as fm

fontsize2use = 10

fig = plt.figure(figsize=(10,5))
plt.xticks(fontsize=fontsize2use)  
plt.yticks(fontsize=fontsize2use)    
fontprop = fm.FontProperties(size=fontsize2use)
ax = fig.add_subplot(111)
ax.set_xlabel('XaxisLabel')
ax.set_ylabel('YaxisLabel')
.
<main plotting code>
.
ax.legend(loc=0, prop=fontprop)     

有关的条宽,如果使用 pyplot.bar 它看起来像您可以与宽度属性播放。

其他提示

看一看 subplots_adjust 或只使用 axes ([left,bottom,width,height])

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top