forked from moreo/QuaPy
adding dynamic plot
This commit is contained in:
parent
13fc48ecca
commit
47b71bd5f2
|
@ -0,0 +1,49 @@
|
|||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
file = './results/RCV1.C4.csv'
|
||||
# plot the data
|
||||
fig, axs = plt.subplots(3)
|
||||
|
||||
while True:
|
||||
df = pd.read_csv(file, sep='\t')
|
||||
|
||||
xs = df['it']
|
||||
|
||||
y_r = df['R']
|
||||
y_rhat = df['Rhat']
|
||||
y_rhatCC = df['RhatCC']
|
||||
label='R'
|
||||
axs[0].plot(xs, y_rhat, label='$\hat{'+label+'}$')
|
||||
axs[0].plot(xs, y_rhatCC, label='$\hat{'+label+'}_{CC}$')
|
||||
axs[0].plot(xs, y_r, label=label)
|
||||
axs[0].legend()
|
||||
axs[0].grid()
|
||||
|
||||
y_r = df['te-prev']
|
||||
y_rhat = df['te-estim']
|
||||
y_rhatCC = df['te-estimCC']
|
||||
label='P'
|
||||
axs[1].plot(xs, y_rhat, label='$\hat{'+label+'}$')
|
||||
axs[1].plot(xs, y_rhatCC, label='$\hat{'+label+'}_{CC}$')
|
||||
axs[1].plot(xs, y_r, label=label)
|
||||
axs[1].legend()
|
||||
axs[1].grid()
|
||||
|
||||
y_ae = df['AE']
|
||||
y_ae_cc = df['AE_CC']
|
||||
axs[2].plot(xs, y_ae, label='AE')
|
||||
axs[2].plot(xs, y_ae_cc, label='AE-CC')
|
||||
axs[2].legend()
|
||||
axs[2].grid()
|
||||
|
||||
#plt.pause(1.0)
|
||||
axs[0].cla()
|
||||
axs[1].cla()
|
||||
axs[2].cla()
|
||||
|
||||
plt.savefig('./plot.png')
|
||||
break
|
||||
|
||||
#plt.show()
|
Loading…
Reference in New Issue