我正在使用 matplotlib-0.91(第一次)创建一个条形图,但是 y 轴标签被切断了。如果我将图形的宽度增加得足够多,它们最终会完全显示出来,但是输出的大小不正确。
有什么办法处理这个吗?
我正在使用 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看起来您可以使用 width 属性。
看看subplots_adjust
,或只是使用。axes
([left,bottom,width,height])