import pandas as pd
import matplotlib.pyplot as plt

plt.style.use("seaborn-paper")

plt.rc('font', family='serif', serif='Times')
# plt.rc('text', usetex=True)
plt.rc('xtick', labelsize=8)
plt.rc('ytick', labelsize=8)
plt.rc('axes', labelsize=8)
width = 3.487
height = width / 1.618
scale= 3.487/16
fig = plt.figure(figsize=(16*scale,16*scale),dpi=200)

df = pd.read_csv("../../output/conv.csv")
iters = df["iters"].values
step = df["step"]
#plastic = df["plastic"].values
plt.plot(iters,df["residual"].values,label="residual")
#plt.plot(iters,plastic,label="plastic")
for i in range(len(df)-1):
    if step[i] != step[i+1]:
        x = iters[i+1]
        plt.axvline(x,color="black")
plt.yscale("log")
plt.legend()
plt.xlabel("Iteration")
plt.ylabel("Residual")
plt.tight_layout()
plt.savefig("./outframes/"+"conv.pdf",dpi=1000)
# plt.show()
