NuMRI/kalman/graphics/figure_func.py

37 lines
980 B
Python

import matplotlib.pyplot as plt
import numpy as np
from itertools import cycle
import argparse
import pickle
import yaml
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
u = np.linspace(-2,2,100)
utrue = 1
venc1 = 0.9*utrue
venc2 = 0.6*utrue
fig1, ax1 = plt.subplots(1,1,figsize=(8, 5))
J1 = 1 - np.cos((utrue-u)/venc1*np.pi)
J2 = 1 - np.cos((utrue-u)/venc2*np.pi)
lwidth = 2
font_size = 28
ax1.plot(u, J1, color = 'orangered', label = '$venc = 0.9 u_{true}$', linestyle='-',linewidth=lwidth)
ax1.plot(u, J2, color = 'dodgerblue', label = '$venc = 0.6 u_{true}$', linestyle='-',linewidth=lwidth)
ax1.axvline(x=1,color = 'black',linewidth = lwidth , label = '$u_{true}$')
ax1.legend(fontsize=20, loc= 'upper right')
ax1.tick_params(axis='both', which='major', labelsize=22)
ax1.set_yticks([])
ax1.set_xlabel('$u$',fontsize=font_size)
plt.show()
fig1.savefig('functionals.png', dpi=500, bbox_inches='tight')