Skip to content

Commit

Permalink
fix: formatting of the x axis on the plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Senja20 committed Nov 5, 2022
1 parent e956878 commit 947abe5
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions data_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,18 @@

date_points = []
reps = []
for row in cur.execute("SELECT * FROM logs"):
print(row[0])
print(row[1])

# date_points.append(datetime.strptime(row[0], '%Y-%m-%d %H:%M:%S.%f').date())
for row in cur.execute("SELECT * FROM logs"):
date_points.append(pd.to_datetime(row[0]))
reps.append(int(row[1]))

dates = matplotlib.dates.date2num(date_points)
# matplotlib.pyplot.plot_date(dates, reps)

plt.scatter(date_points, reps)
plt.title("Data")
plt.xlabel("dates")
plt.title("Push Ups")
plt.xlabel("Dates")
plt.ylabel("number of push ups")
plt.gcf().autofmt_xdate()
myFmt = mdates.DateFormatter("%H:%M")
plt.gca().xaxis.set_major_formatter(myFmt)
plt.tick_params(rotation=45)
plt.show()
plt.close()

0 comments on commit 947abe5

Please sign in to comment.