Created
June 30, 2021 07:13
-
-
Save MrMikeFloyd/d5bac868182c892ca2eec9dacbf4d3b9 to your computer and use it in GitHub Desktop.
Python script that reads a file and plots its records.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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