Is there a way to add a daily total to a graph made with matplotlib. Here’s what I currently create:

What I want to do is insert totals for each day like: “where the daily totals are the the sums of all hourly values for that day.

Currently my data is in a csv, here’s a single days worth:
2012-02-13 05:00:00,65217
2012-02-13 06:00:00,82418
2012-02-13 07:00:00,71316
2012-02-13 08:00:00,66833
2012-02-13 09:00:00,69406
2012-02-13 10:00:00,76422
2012-02-13 11:00:00,94188
2012-02-13 12:00:00,111817
2012-02-13 13:00:00,127002
2012-02-13 14:00:00,141099
2012-02-13 15:00:00,147830
2012-02-13 16:00:00,136330
2012-02-13 17:00:00,122252
2012-02-13 18:00:00,118619
2012-02-13 19:00:00,115763
2012-02-13 20:00:00,121393
2012-02-13 21:00:00,130022
2012-02-13 22:00:00,137658
2012-02-13 23:00:00,139363
And I’m plotting it with:
data = csv2rec('temp.csv', names=['time', 'values'])
rcParams['figure.figsize'] = 12, 6
rcParams['font.size'] = 8
fig = plt.figure()
plt.plot(data['time'], data['value'])
ax = fig.add_subplot(111)
ax.plot(data['time'], data['value'])
days = mdates.DayLocator()
fmt = mdates.DateFormatter('%D')
ax.xaxis.set_major_locator(days)
ax.xaxis.set_major_formatter(fmt)
fig.autofmt_xdate(bottom=0.2, rotation=90, ha='left')
ax.grid()
plt.savefig(output_name)
There’s probably a better way to do this but what I was thinking was to sum the daily values from the csv and store them in an array, the use “legend” with some sort of small function to figure out placement and put those values from the array into it. ?? Does that sound right or does someone have a better way?
for sure the matplotlib is a matlab-like library. It provides the ability of writing text for annotation. as shown in the following picture (even more complicated than what you wanted):

the documentation page with source code can be found here:
http://matplotlib.sourceforge.net/api/pyplot_api.html
http://matplotlib.sourceforge.net/users/annotations.html
and
http://matplotlib.sourceforge.net/users/text_props.html