analistica/ex-6/plots/emd-round.py

44 lines
1.2 KiB
Python
Raw Normal View History

2020-05-13 01:16:45 +02:00
import numpy as np
import matplotlib.pyplot as plt
def plot(table, title='', log=False):
2020-05-19 18:56:26 +02:00
plt.figure(figsize=(6.3, 6))
2020-05-13 01:16:45 +02:00
plt.suptitle(title)
plt.subplot(211)
if log:
plt.xscale('log')
2020-05-19 18:56:26 +02:00
plt.title('EMD' + ' '*10, loc='right')
2020-05-13 01:16:45 +02:00
plt.plot(table[0], table[1], color='#92182b')
plt.tick_params(axis='y', labelcolor='#92182b')
plt.ylabel('average', color='#92182b')
2020-05-19 18:56:26 +02:00
plt.ticklabel_format(style='sci', axis='y',
scilimits=(0, 0), useMathText=True)
2020-05-13 01:16:45 +02:00
twin = plt.twinx()
twin.plot(table[0], table[2], color='gray')
twin.tick_params(axis='y', labelcolor='gray')
twin.set_ylabel('standard deviation', color='gray')
2020-05-19 18:56:26 +02:00
twin.ticklabel_format(style='sci', axis='y',
scilimits=(0, 0), useMathText=True)
2020-05-13 01:16:45 +02:00
plt.subplot(212)
if log:
plt.xscale('log')
plt.title('skewness', loc='right')
plt.xlabel('RL rounds')
plt.plot(table[0], table[3], color='xkcd:gray')
2020-05-19 18:56:26 +02:00
plt.tight_layout()
2020-05-13 01:16:45 +02:00
2020-05-13 01:20:51 +02:00
table = np.loadtxt('ex-6/plots/emd-round.txt')
2020-05-13 01:16:45 +02:00
plot(table[:27].T, title='noiseless', log=True)
2020-05-19 18:56:26 +02:00
plot(table[27:47].T, title=r'noise at $\sigma=0.005$')
plot(table[47:67].T, title=r'noise at $\sigma=0.01$')
plot(table[67:].T, title=r'noise at $\sigma=0.05$')
2020-05-13 01:16:45 +02:00
plt.show()