Using the calmap package I create a heatmap calendar but I would like to know how to increase the font or the size of the plot.
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)
This should fix your issue
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"]=20,20
Based on the documentation:
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):
There is an ax
parameter. It corresponds to the axis on which the figure must be draw. First create an axis with the desired size.
from matplotlib import pyplot as plt
f, ax = plt.subplots(1, 1, figsize = (15, 10))
calmap.yearplot(events, year=2015, ax=ax)
EDIT: For font size, work on the axis. Something like this:
for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(20)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With