Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:49:41+00:00 2026-06-05T15:49:41+00:00

Is there a way to add a daily total to a graph made with

  • 0

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

Current Plot

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.

enter image description here

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:49:42+00:00Added an answer on June 5, 2026 at 3:49 pm

    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):
    enter image description here

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to add a customize DatagridviewRow using c#? Ive made a
Is there a way to add individual labels when you specify a graph using
There is way to add date to the post in Drupal? For example here
I created this regular expression to validate names: ^[a-zA-Z0-9\s\-\,]+.\*?$ Is there a way add
Is there a way to add the ActiveMQ component via javacode in Spring's applicationConfig
Is there a way to add the select-result on the url when the pop
Is there a way to add a progress bar in the footer (fbar) of
Is there a way to add a text-shadow in CSS that is similar to
Is there a way to add custom template inside Telerik MVC Combobox.? I have
Is there a way to add keyboard navigation to links with just css3, without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.