backgammon/plot.py

37 lines
811 B
Python
Raw Normal View History

2018-03-08 15:36:16 +00:00
import sys
import pandas as pd
from datetime import datetime
import csv
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import matplotlib.dates as mdates
from matplotlib.backends.backend_pdf import PdfPages
2018-03-08 16:51:32 +00:00
headers = ['Phase', 'Method', 'Start episodes', 'Episodes', 'Sum', 'Mean']
2018-03-08 15:36:16 +00:00
fig, ax = plt.subplots(1, 1)
2018-03-08 16:13:25 +00:00
plt.ion()
2018-03-08 15:36:16 +00:00
plt.title('Mean over episodes')
plt.xlabel('Episodes')
plt.ylabel('Mean')
plt.grid(True)
2018-03-08 16:13:25 +00:00
#ax.set_xlim(left=0)
ax.set_ylim([-2, 2])
2018-03-08 15:36:16 +00:00
plt.show()
2018-03-08 16:13:25 +00:00
while True:
#df = pd.read_csv(sys.stdin, sep=";", names=headers)
df = pd.read_csv('log', sep=";", names=headers)
2018-03-08 16:51:32 +00:00
df['Total episodes'] = df['Start episodes'] + 100
2018-03-08 16:13:25 +00:00
2018-03-08 16:51:32 +00:00
print(df)
2018-03-08 16:13:25 +00:00
x = df['Total episodes']
y = df['Mean']
plt.scatter(x, y, c=[[1,0.5,0]])
#fig.canvas.draw()
plt.pause(2)