Skip to main content

Heartbeat data plotter for matplotlib

Project description

This is just a tool for taking activity "heartbeats" (where something outputs what it is currently doing periodically) and making a few interesting charts and graphs with it using matplotlib.

This was originally written specifically for Wakatime data, but there's no reason it couldn't be applied to other things. For example, I am planning on using this with Discord rich presense activity exports.

Example usage (Wakapi):

from sqlite3 import connect
from datetime import datetime
from HeartbeatsData.heartbeats_data import HeartbeatData, show

print("Reading data")
conn = connect("../wakapi_db.db")
cur = conn.cursor()
hbs = cur.execute("SELECT project,time FROM heartbeats WHERE user_id='hopperelec'").fetchall()

print("Parsing data")
hb_data = HeartbeatData()
for hb in hbs:
    hb_data.add_hb(hb[0], datetime.strptime(hb[1][:19] + hb[1][-6:], "%Y-%m-%d %H:%M:%S%z"))

print("Producing legend")
hb_data.legend(ncol=2)

print("Plotting data")
# hb_data.plot_scatter()
hb_data.plot_durations(slider_kwargs={"default": 900})
# hb_data.plot_duration_counts(False, True, slider_kwargs={"default": 5400})

print("Displaying plot")
show()

Samples

(using the above code, all with the same data)

Scatter (time / day) graph Durations (time / day) graph Daily line duration counts (time / count) graph Weekly line duration counts (time and weekday / count) graph Daily heatmap duration counts (time / count) graph Weekly heatmap duration counts (time and weekday / count) graph

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

HeartbeatsData-1.0.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

HeartbeatsData-1.0.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file HeartbeatsData-1.0.0.tar.gz.

File metadata

  • Download URL: HeartbeatsData-1.0.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for HeartbeatsData-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7ee3a1d54e18b1e60fa1be115bed3e1f05027ab2794b0a756ffa1a9e217154b8
MD5 e5d4416be7b027d7acc4ae49f5e855e5
BLAKE2b-256 302083b912ab497d394cfe73fb38db1d4c2f20551e983fcc1c7d0df22e46b5b0

See more details on using hashes here.

File details

Details for the file HeartbeatsData-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: HeartbeatsData-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for HeartbeatsData-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98460d6a49d4600f5e61fd7b276eb07bb354a9056467fc3217489994c19190b6
MD5 2393a0df56c5be4352373989c61c9029
BLAKE2b-256 c55d396cd7357efe9b4326ae23dbcfae6e765422bdc331d2c78308406c275a72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page