使用calalap程序包,我创建了一个热图日历,但是我想知道如何增加字体或绘图的大小。
import numpy as np; np.random.seed(sum(map(ord, 'calmap')))
import pandas as pd
import calmap
all_days = pd.date_range('1/15/2014', periods=700, freq='D')
days = np.random.choice(all_days, 500)
events = pd.Series(np.random.randn(len(days)), index=days)
calmap.yearplot(events, year=2015)
答案 0 :(得分:5)
这应该可以解决您的问题
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"]=20,20
答案 1 :(得分:1)
def yearplot(data, year=None, how='sum', vmin=None, vmax=None, cmap='Reds',
fillcolor='whitesmoke', linewidth=1, linecolor=None,
daylabels=calendar.day_abbr[:], dayticks=True,
monthlabels=calendar.month_abbr[1:], monthticks=True, ax=None,
**kwargs):
有一个ax
参数。它对应于必须绘制图形的轴。首先创建具有所需尺寸的轴。
from matplotlib import pyplot as plt
f, ax = plt.subplots(1, 1, figsize = (15, 10))
calmap.yearplot(events, year=2015, ax=ax)
编辑:对于字体大小,在轴上工作。像这样:
for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(20)