backgammon/plot.py

35 lines
756 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
headers = ['Phase', 'Method', 'Total episodes', 'Episodes', 'Sum', 'Mean']
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)
x = df['Total episodes']
y = df['Mean']
plt.scatter(x, y, c=[[1,0.5,0]])
print("draw")
#fig.canvas.draw()
plt.pause(2)