Skip to content

Instantly share code, notes, and snippets.

@MrMikeFloyd
Created June 30, 2021 07:13
Show Gist options
  • Save MrMikeFloyd/d5bac868182c892ca2eec9dacbf4d3b9 to your computer and use it in GitHub Desktop.
Save MrMikeFloyd/d5bac868182c892ca2eec9dacbf4d3b9 to your computer and use it in GitHub Desktop.
Python script that reads a file and plots its records.
import matplotlib.pyplot as plt
def read_file():
with open("response-times-records.txt") as f:
# This assumes that lines are formatted like so:
# 42.123456|2021-07-01 12:00:00.000000
return [line.rstrip().split("|") for line in f]
def plot_response_times():
records = read_file()
x = [e[1] for e in records]
y = [float(e[0]) for e in records]
plt.scatter(x, y)
plt.ylabel("Response Time")
plt.xlabel("Timestamp")
plt.show()
plot_response_times()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment