Created
February 15, 2019 07:13
-
-
Save udzura/576c91274bd6b1657bff97e631a2e9fd to your computer and use it in GitHub Desktop.
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
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import re | |
data = """ | |
some avg10=0.00 avg60=0.52 avg300=4.18 total=159949297 [7/309513] | |
some avg10=0.00 avg60=0.52 avg300=4.18 total=159949297 | |
some avg10=0.00 avg60=0.50 avg300=4.15 total=159949297 | |
... | |
""" | |
xdata = [] | |
a10data = [] | |
a60data = [] | |
a300data = [] | |
rexp = r'some avg10=([\.\d]+) avg60=([\.\d]+) avg300=([\.\d]+)' | |
for i, tgt in enumerate(data.split("\n")): | |
result = re.match(rexp, tgt) | |
if result: | |
xdata.append(i) | |
a10data.append(float(result.group(1))) | |
a60data.append(float(result.group(2))) | |
a300data.append(float(result.group(3))) | |
plt.plot(xdata, a10data, linewidth=1, color="brown", label="avg10") | |
plt.plot(xdata, a60data, linewidth=1, color="green", label="avg60") | |
plt.plot(xdata, a300data, linewidth=1, color="purple", label="avg300") | |
plt.xlabel("elapsed time (sec)") | |
plt.ylabel("value") | |
plt.grid(axis='y',which='major',color='black',linestyle=':') | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment