# -*- coding: utf-8 -*-

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.lines as mlines
import matplotlib.gridspec as gridspec
from matplotlib.ticker import LogLocator

YStress = []
YStress = np.loadtxt('YStress.dat',delimiter=',')

YStress = np.delete(YStress,0,0)

fig, ax = plt.subplots(figsize=(12, 9))

widthline = 3
flabsize = 45
fticksize = 30

ax.plot(YStress[:,0],YStress[:,4], ':', c='grey',linewidth=widthline,label=r'$\sigma_{wc}$')
ax.plot(YStress[:,0],YStress[:,5], '--', c='grey',linewidth=widthline,label=r'$\sigma_{sc}$')
ax.plot(YStress[:,0],YStress[:,6], '-.', c='grey',linewidth=widthline,label=r'$\sigma_{or}$')
ax.plot(YStress[:,0],YStress[:,7], c='r',linewidth=4,label=r'$\sigma_{ys}$')

ax.set_xlabel(u'$t$, min', fontsize=flabsize, labelpad=15)
ax.set_ylabel(u'$\sigma$, MPa', fontsize=flabsize, labelpad=15)

ax.tick_params(axis='x', labelsize=fticksize, pad = 10)
ax.tick_params(axis='y', labelsize=fticksize, pad = 10, colors='black')


#ax.xaxis.grid(True)

#ax2.set_xscale("log", nonposx='clip')
#ax2_2.set_yscale("log", nonposx='clip')
ax.set_xscale("log", nonposx='clip')
ax.xaxis.set_major_locator(LogLocator(base = 1000.0))
ax.set_xlim(1E-4, 1000)
ax.set_ylim(0, 800)

#plt.locator_params(axis = 'x', nbins = 4)
plt.locator_params(axis = 'y', nbins = 5)
handles, labels = ax.get_legend_handles_labels()
plt.legend(handles, labels, loc='upper left', fontsize=30)

#ax.set_ylim(0, 0.8)
#ax.set_xlim(0, 20000)
#ax.grid(True)
#ax2.grid(True)

fig.tight_layout()


plt.show()

