#!/usr/bin/env python
# coding=utf-8
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] =8, 5
#plt.rcParams['figure.dpi'] =600
plt.rcParams['savefig.dpi'] = 600
plt.rcParams['font.family'] = 'serif'
rho=1000
n=12
D=0.3052
crp6= np.loadtxt("./openwatercrp4.txt",usecols=(0,1,2,3,4,5,6),unpack='true')
plt.plot(crp6[0],crp6[1], \
color='r',marker='',markevery=20,markerfacecolor='none',markeredgecolor='r', \
markersize=8,lw=2,linestyle='-',label='$K_T(CFD)$')
plt.plot(crp6[0],crp6[2], \
color='k',marker='s',markerfacecolor='none',markeredgecolor='k', \
markersize=8,lw=2,linestyle='',label='$K_T(EFD)$')
plt.plot(crp6[0],crp6[3], \
color='k',marker='',markevery=20,markerfacecolor='none',markeredgecolor='k', \
markersize=8,lw=2,linestyle='-',label='$10K_Q(CFD)$')
plt.plot(crp6[0],crp6[4], \
color='k',marker='v',markerfacecolor='none',markeredgecolor='k', \
markersize=8,lw=2,linestyle='',label='$10K_Q(EFD)$')
plt.plot(crp6[0],crp6[5], \
color='b',marker='',markevery=20,markerfacecolor='none',markeredgecolor='b', \
markersize=8,lw=2,linestyle='-',label='$\eta_0(CFD)$')
plt.plot(crp6[0],crp6[6], \
color='b',marker='o',markerfacecolor='none',markeredgecolor='b', \
markersize=8,lw=2,linestyle='',label='$\eta_0(EFD)$')
#plt.plot((front[0]-0.6)/0.08333,(-front[1]-front[2])/(rho*pow(n,2)*pow(D,4)),\
# color='b',marker='',markevery=20,markerfacecolor='none',markeredgecolor='r',\
# markersize=8,lw=2,linestyle='-',label='$K_T(Single)$')
#
#
#plt.plot((front[0]-0.6)/0.0833,-10*(front[3]+front[4])/(rho*pow(n,2)*pow(D,5)),\
# color='b',marker='',markevery=20,markerfacecolor='none',markeredgecolor='k',\
# markersize=8,lw=2,linestyle='-',label='$10K_T(Single)$')
#
#
#plt.plot((crp[0]-0.6)/0.083333,(-crp[1]-crp[2])/(rho*pow(n,2)*pow(D,4)),color='k',\
# marker='',markevery=20,markerfacecolor='none',markeredgecolor='k',markersize=8,\
# lw=2,linestyle='--',label='$K_T(CRPs)$')
#
#
#plt.plot((crp[0]-0.6)/0.083333,-10*(crp[3]+crp[4])/(rho*pow(n,2)*pow(D,5)),color='k',\
# marker='',markevery=20,markerfacecolor='none',markeredgecolor='k',markersize=8,\
#lw=2,linestyle='--',label='$10K_T(CRPs)$')
##for tick in ax.xaxis.get_major_ticks():
# tick.label.set_fontsize(50)
#plt.plot.set_xlabel(fontsize=50)
#plt.ylim([-1,2])
#plt.xlim([0,200])
#plt.xlabel("T/(s)", size=12,fontsize=50)
#plt.ylabel("Wave elevation (m))", size=12)
plt.grid()
plt.legend(fancybox=True,handlelength=3,fontsize=8,ncol=3)
#plt.subplot(2,1,2)
#plt.plot(x-1.3,y,color='b',lw=2,linestyle='--',label='Theoretical waveform')
#plt.plot(x1,y1*0.99,color='black',lw=2,linestyle='-', label='Numerical waveform')
#plt.hlines(y2,0,300,color='black',linestyle='-.')
#plt.hlines(y3,0,300,color='grey',linestyle='-.',label='Wave crest and trough')
#plt.plot(y=y3,color='grey',linestyle='-.')
plt.xlabel("$J$", size=16)
plt.ylabel("$K_T,10K_Q, \eta_0$", size=16)
#plt.ylabel("$K_T,10K_Q,\eta_0$", size=16)
plt.xlim([0.68,1.12])
plt.ylim([0.1,1])
plt.grid()
plt.legend(loc='upper center',fancybox=False,ncol=3,handlelength=2,fontsize=12)
#plt.legend(loc='upper center',bbox_to_anchor=(0.5,0.5),fancybox=False,ncol=3,handlelength=2,fontsize=13)
plt.tight_layout()
plt.savefig('./owcrp4.png')
plt.show()