analistica/ex-5/plot.py
Giù Marcer bdc12117a7 ex-5: revised and typo-fixed
Some images and an article have also been added to the folder.
The todo has been updated too as well as the readme.
2020-07-05 11:35:49 +02:00

23 lines
723 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import sys
calls, I_MC, σ_MC, I_MI, σ_MI, I_VE, σ_VE, chi = np.loadtxt(sys.stdin, unpack=True)
exact = 1.7182818285
plt.rcParams['font.size'] = 17
plt.figure()
plt.title('Plain MC', loc='right')
plt.ylabel('$I^{oss}$')
plt.xlabel('calls')
plt.axhline(y=exact, color='#c556ea', linestyle='-', label='Exact value')
plt.errorbar(calls, I_MC, linestyle='', marker='o', yerr=σ_MC, color='#92182b', label='Plain MC')
plt.errorbar(calls, I_MI, linestyle='', marker='o', yerr=σ_MI, color='black', label='MISER')
plt.errorbar(calls, I_VE, linestyle='', marker='o', yerr=σ_VE, color='gray', label='VEGAS')
plt.legend()
plt.show()