def add_cal_coefficients_to_axes(ax, table):
"""
Plots calibration coefficients on the CO plot.
"""
_xlim=ax.get_xlim()
_ylim=ax.get_ylim()
for line in table:
#print(line)
if ((date2num(datetime.datetime.strptime(line[0], '%Y-%m-%d %H:%M:%S')) > _xlim[0]) &
(date2num(datetime.datetime.strptime(line[1], '%Y-%m-%d %H:%M:%S')) < _xlim[1])):
x=(date2num(datetime.datetime.strptime(line[0], '%Y-%m-%d %H:%M:%S')) + \
date2num(datetime.datetime.strptime(line[1], '%Y-%m-%d %H:%M:%S')))/2.0
y=0.8*_ylim[1]
#http://stackoverflow.com/questions/17086847/box-around-text-in-matplotlib
ax.text(x, y, '\n'.join([i.strip() for i in line[2:]]), horizontalalignment='center', verticalalignment='top',
fontsize='small', color='black', bbox=dict(facecolor='wheat', edgecolor='black', boxstyle='round,pad=0.6'))
评论列表
文章目录