Battery discharge curve
#3
Sure,  here is the code:

Code:
import matplotlib.pyplot as plt
from matplotlib.ticker import (MultipleLocator)
import json
data = json.load(open('pinetime-battery-log.json'))

# Set things up.
fig, ax = plt.subplots(figsize=(10, 8))

# Massage the data to be easier to interpret, and draw it.
xaxis = [e[0] / 60 / 60 for e in data]
yaxis = [e[1] * 2 / (4095 / 3.0) for e in data]
ax.scatter(xaxis, yaxis, s=1)

# Draw some labels.
plt.xlabel('Time (hours)')
plt.ylabel('Voltage')
plt.title('Battery discharge curve')

# Draw the grid.
plt.grid(which='both')
plt.minorticks_on()
plt.grid(b=True, which='minor', alpha=0.3)
ax.yaxis.set_major_locator(MultipleLocator(0.1))
ax.xaxis.set_major_locator(MultipleLocator(1))
ax.xaxis.set_minor_locator(MultipleLocator(10/60))

# Show the chart.
plt.show()

Note that this is the first time I use matplotlib, I might have done some weird things.


Messages In This Thread
Battery discharge curve - by ayke - 10-30-2019, 04:04 AM
Battery discharge curve - by maiden - 10-30-2019, 04:23 AM
RE: Battery discharge curve - by ayke - 10-30-2019, 04:40 AM
RE: Battery discharge curve - by maiden - 10-30-2019, 05:57 AM
RE: Battery discharge curve - by caligari - 10-30-2019, 06:34 AM
RE: Battery discharge curve - by aritual - 09-20-2020, 10:44 AM
Battery discharge curve - by maiden - 10-30-2019, 07:17 AM
RE: Battery discharge curve - by caligari - 10-30-2019, 05:35 PM
RE: Battery discharge curve - by ayke - 10-30-2019, 07:35 AM
Battery discharge curve - by maiden - 10-30-2019, 05:46 PM
RE: Battery discharge curve - by pfeerick - 11-22-2019, 04:26 AM
RE: Battery discharge curve - by JF002 - 12-31-2019, 08:11 AM
RE: Battery discharge curve - by pfeerick - 01-02-2020, 02:33 AM
RE: Battery discharge curve - by JF002 - 01-02-2020, 04:33 AM
RE: Battery discharge curve - by pfeerick - 01-03-2020, 04:18 AM
RE: Battery discharge curve - by geoffrey.vl - 05-02-2020, 07:32 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)