我想打印日历月份,如下图所示。我使用以下行来生成日历
import calendar
import matplotlib.pyplot as plt
# key represents year and values represents required months
cal = {2013: range(11,13),2014: range(1,13), 2015: range(1,9)}
result = []
for key,value in cal.items():
year = key
months = value
for month in months:
result.append(calendar.month(year,month))
现在,每个月都作为字符串对象存储在结果对象中。要以网格格式打印月份,我使用以下行:
f,ax = plt.subplots(nrows=8,ncols=3)
for row in ax:
for col in row:
plt.text(result[row+col])
我想我需要使用其他功能代替plt.text()
。我需要更改此功能还是需要添加其他一些行?
footer