【发布时间】:2014-04-03 14:59:40
【问题描述】:
使用此代码绘制多个图表我似乎无法调整标题上的字体大小,我需要它们更大...代码中的字体代码确实加粗了轴标签,但似乎也没有加粗标题或更改轴标签的大小或粗体或更改标题..所以我猜它被布局中的某些东西覆盖了?
area_tabs=['1']
nrows = int(math.ceil(len(area_tabs) / 2.))
figlen=nrows*7 #adjust the figure size height to be sized to the number of rows
plt.rcParams['figure.figsize'] = 25,figlen
font = {'family' : 'normal',
'weight' : 'bold',
'size' : 30}
matplotlib.rc('font', **font)
fig, axs = plt.subplots(nrows, 2, sharey=False)
for ax, area_tabs in zip(axs.flat, area_tabs):
ax.xaxis.grid(True, which='both')
actdf, aname = get_data(area_tabs)
fullyrs,lastq,fcast_yr,projections,yrahead,aname,actdf,merged2,mergederrs,montdist,ols_test, mergedfcst,curr_month=do_projections(actdf,aname)
lastyrtot=str(merged2['Units'][-2:-1].iloc[0])
mergederrs[['fcast','Units']].tail(12).plot(ax=ax, title='''Area: {0} Forecast for 2014 {1:,} vs. Actual 2013 of {2:,}
{3} sales year to date, compared to forecast of {4} a cumulative error of {5}%'''.format(unicode(aname),int(mergederrs['fcastcum'][-1:].iloc[0]),
int(float((lastyrtot))),int(mergederrs['unitscum'][curr_month]),int(mergederrs['fcastcum'][curr_month]),(mergederrs['cumerrpercent'][curr_month])))
产生这样的结果:
【问题讨论】:
-
ax.set_title('title text', size=100) -
标题是在最后一行通过.plot(ax=ax......动态设置的,怎么办?
-
将最后一行修改为 [curr_month]), size=100)) 没有任何作用
-
嘿伙计——只是一个提示:你的例子应该是可重现的。就目前而言,没有人可以使用所有未定义的变量和函数运行此代码。
-
对不起,我通常会尝试这样做!这里的复杂性是问题的一部分..(不是一个好的借口)
标签: python matplotlib pandas