Skip to content

Instantly share code, notes, and snippets.

@Julian-Nash
Created June 6, 2018 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Julian-Nash/aeb2d05a7633cf928e24564569215f39 to your computer and use it in GitHub Desktop.
Save Julian-Nash/aeb2d05a7633cf928e24564569215f39 to your computer and use it in GitHub Desktop.
parsing temperature logger data from raspberry pi
import matplotlib.pyplot as plt
data_points = {}
with open("test_data.txt", "r") as f:
for line in f:
date, temp = line.split("|")
temp = temp.strip()
data_points.update({date: temp})
date_ = [date for date in data_points.values()]
temp_ = [temp for temp in data_points.keys()]
plt.plot(date_, temp_)
plt.show()
06-06-2018 13:18:39 | 21.937
06-06-2018 13:23:39 | 22.937
06-06-2018 13:28:39 | 23.937
06-06-2018 13:33:39 | 24.937
06-06-2018 13:38:39 | 25.937
06-06-2018 13:43:39 | 26.937
06-06-2018 13:48:39 | 27.937
06-06-2018 13:53:39 | 28.937
06-06-2018 13:58:39 | 29.937
06-06-2018 13:03:39 | 30.937
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment