chenyun-delft3d
import pandas as pd
import numpy as np
import glob
import datetime as dt
import re
from matplotlib import pyplot as plt
from pylab import *
import matplotlib.patches as patches

font1 = {\'family\': \'Times New Roman\',
\'weight\': \'normal\',
\'size\': 5.5,
}
# 鸽笼港
df = pd.read_csv(r\'.\鸽笼港1958.txt\', delim_whitespace=True)
df1 = pd.read_csv(r\'.\鸽笼港1984.txt\', delim_whitespace=True)
df2 = pd.read_csv(r\'.\鸽笼港1987.txt\', delim_whitespace=True)
df3 = pd.read_csv(r\'.\鸽笼港1990.txt\', delim_whitespace=True)
df4 = pd.read_csv(r\'.\鸽笼港1992.txt\', delim_whitespace=True)
df5 = pd.read_csv(r\'.\鸽笼港1997.txt\', delim_whitespace=True)
df6 = pd.read_csv(r\'.\鸽笼港1998.txt\', delim_whitespace=True)
df7 = pd.read_csv(r\'.\鸽笼港2001.txt\', delim_whitespace=True)
df8 = pd.read_csv(r\'.\鸽笼港2003.txt\', delim_whitespace=True)
df9 = pd.read_csv(r\'.\鸽笼港2009.txt\', delim_whitespace=True)
df10 = pd.read_csv(r\'.\鸽笼港2013.txt\', delim_whitespace=True)
df11 = pd.read_csv(r\'.\鸽笼港2016.txt\', delim_whitespace=True)
df12 = pd.read_csv(r\'.\鸽笼港2019.txt\', delim_whitespace=True)
# 南门港
df13 = pd.read_csv(r\'.\南门1958.txt\', delim_whitespace=True)
df14 = pd.read_csv(r\'.\南门1984.txt\', delim_whitespace=True)
df15 = pd.read_csv(r\'.\南门1987.txt\', delim_whitespace=True)
df16 = pd.read_csv(r\'.\南门1990.txt\', delim_whitespace=True)
df17 = pd.read_csv(r\'.\南门1992.txt\', delim_whitespace=True)
df18 = pd.read_csv(r\'.\南门1997.txt\', delim_whitespace=True)
df19 = pd.read_csv(r\'.\南门1998.txt\', delim_whitespace=True)
df20 = pd.read_csv(r\'.\南门2001.txt\', delim_whitespace=True)
df21 = pd.read_csv(r\'.\南门2003.txt\', delim_whitespace=True)
df22 = pd.read_csv(r\'.\南门2009.txt\', delim_whitespace=True)
df23 = pd.read_csv(r\'.\南门2013.txt\', delim_whitespace=True)
df24 = pd.read_csv(r\'.\南门2016.txt\', delim_whitespace=True)
df25 = pd.read_csv(r\'.\南门2019.txt\', delim_whitespace=True)
# 老滧港
df26 = pd.read_csv(r\'.\老滧港1958.txt\', delim_whitespace=True)
df27 = pd.read_csv(r\'.\老滧港1984.txt\', delim_whitespace=True)
df28 = pd.read_csv(r\'.\老滧港1987.txt\', delim_whitespace=True)
df29 = pd.read_csv(r\'.\老滧港1990.txt\', delim_whitespace=True)
df30 = pd.read_csv(r\'.\老滧港1992.txt\', delim_whitespace=True)
df31 = pd.read_csv(r\'.\老滧港1997.txt\', delim_whitespace=True)
df32 = pd.read_csv(r\'.\老滧港1998.txt\', delim_whitespace=True)
df33 = pd.read_csv(r\'.\老滧港2001.txt\', delim_whitespace=True)
df34 = pd.read_csv(r\'.\老滧港2003.txt\', delim_whitespace=True)
df35 = pd.read_csv(r\'.\老滧港2009.txt\', delim_whitespace=True)
df36 = pd.read_csv(r\'.\老滧港2013.txt\', delim_whitespace=True)
df37 = pd.read_csv(r\'.\老滧港2016.txt\', delim_whitespace=True)
df38 = pd.read_csv(r\'.\老滧港2019.txt\', delim_whitespace=True)
# 张网港
df39 = pd.read_csv(r\'.\张网港1958.txt\', delim_whitespace=True)
df40 = pd.read_csv(r\'.\张网港1984.txt\', delim_whitespace=True)
df41 = pd.read_csv(r\'.\张网港1987.txt\', delim_whitespace=True)
df42 = pd.read_csv(r\'.\张网港1990.txt\', delim_whitespace=True)
df43 = pd.read_csv(r\'.\张网港1992.txt\', delim_whitespace=True)
df44 = pd.read_csv(r\'.\张网港1997.txt\', delim_whitespace=True)
df45 = pd.read_csv(r\'.\张网港1998.txt\', delim_whitespace=True)
df46 = pd.read_csv(r\'.\张网港2001.txt\', delim_whitespace=True)
df47 = pd.read_csv(r\'.\张网港2003.txt\', delim_whitespace=True)
df48 = pd.read_csv(r\'.\张网港2009.txt\', delim_whitespace=True)
df49 = pd.read_csv(r\'.\张网港2013.txt\', delim_whitespace=True)
df50 = pd.read_csv(r\'.\张网港2016.txt\', delim_whitespace=True)
df51 = pd.read_csv(r\'.\张网港2019.txt\', delim_whitespace=True)
# 新河港
df52 = pd.read_csv(r\'.\新河港1958.txt\', delim_whitespace=True)
df53 = pd.read_csv(r\'.\新河港1984.txt\', delim_whitespace=True)
df54 = pd.read_csv(r\'.\新河港1987.txt\', delim_whitespace=True)
df55 = pd.read_csv(r\'.\新河港1990.txt\', delim_whitespace=True)
df56 = pd.read_csv(r\'.\新河港1992.txt\', delim_whitespace=True)
df57 = pd.read_csv(r\'.\新河港1997.txt\', delim_whitespace=True)
df58 = pd.read_csv(r\'.\新河港1998.txt\', delim_whitespace=True)
df59 = pd.read_csv(r\'.\新河港2001.txt\', delim_whitespace=True)
df60 = pd.read_csv(r\'.\新河港2003.txt\', delim_whitespace=True)
df61 = pd.read_csv(r\'.\新河港2009.txt\', delim_whitespace=True)
df62 = pd.read_csv(r\'.\新河港2013.txt\', delim_whitespace=True)
df63 = pd.read_csv(r\'.\新河港2016.txt\', delim_whitespace=True)
df64 = pd.read_csv(r\'.\新河港2019.txt\', delim_whitespace=True)

# 鸽笼港1958-1998

x1 = np.array(df[\'X\'])
x2 = np.array(df1[\'X\'])
x3 = np.array(df2[\'X\'])
x4 = np.array(df3[\'X\'])
x5 = np.array(df4[\'X\'])
x6 = np.array(df5[\'X\'])
x7 = np.array(df6[\'X\'])
y1 = np.array(df[\'Graphic\']) * -1
y2 = np.array(df1[\'Graphic\']) * -1
y3 = np.array(df2[\'Graphic\']) * -1
y4 = np.array(df3[\'Graphic\']) * -1
y5 = np.array(df4[\'Graphic\']) * -1
y6 = np.array(df5[\'Graphic\']) * -1
y7 = np.array(df6[\'Graphic\']) * -1
# 2001-2019 鸽笼港
x8 = np.array(df7[\'X\'])
x9 = np.array(df8[\'X\'])
x10 = np.array(df9[\'X\'])
x11 = np.array(df10[\'X\'])
x12 = np.array(df11[\'X\'])
x13 = np.array(df12[\'X\'])
y8 = np.array(df7[\'Graphic\']) * -1
y9 = np.array(df8[\'Graphic\']) * -1
y10 = np.array(df9[\'Graphic\']) * -1
y11 = np.array(df10[\'Graphic\']) * -1
y12 = np.array(df11[\'Graphic\']) * -1
y13 = np.array(df12[\'Graphic\']) * -1

# 南门港 1958-1998
x14 = np.array(df13[\'X\'])
x15 = np.array(df14[\'X\'])
x16 = np.array(df15[\'X\'])
x17 = np.array(df16[\'X\'])
x18 = np.array(df17[\'X\'])
x19 = np.array(df18[\'X\'])
x20 = np.array(df19[\'X\'])
y14 = np.array(df13[\'Graphic\']) * -1
y15 = np.array(df14[\'Graphic\']) * -1
y16 = np.array(df15[\'Graphic\']) * -1
y17 = np.array(df16[\'Graphic\']) * -1
y18 = np.array(df17[\'Graphic\']) * -1
y19 = np.array(df18[\'Graphic\']) * -1
y20 = np.array(df19[\'Graphic\']) * -1
# 南门 2001-2019
x21 = np.array(df20[\'X\'])
x22 = np.array(df21[\'X\'])
x23 = np.array(df22[\'X\'])
x24 = np.array(df23[\'X\'])
x25 = np.array(df24[\'X\'])
x26 = np.array(df25[\'X\'])
y21 = np.array(df20[\'Graphic\']) * -1
y22 = np.array(df21[\'Graphic\']) * -1
y23 = np.array(df22[\'Graphic\']) * -1
y24 = np.array(df23[\'Graphic\']) * -1
y25 = np.array(df24[\'Graphic\']) * -1
y26 = np.array(df25[\'Graphic\']) * -1
# 老滧港 1958-1998
x27 = np.array(df26[\'X\'])
x28 = np.array(df27[\'X\'])
x29 = np.array(df28[\'X\'])
x30 = np.array(df29[\'X\'])
x31 = np.array(df30[\'X\'])
x32 = np.array(df31[\'X\'])
x33 = np.array(df32[\'X\'])
y27 = np.array(df26[\'Graphic\']) * -1
y28 = np.array(df27[\'Graphic\']) * -1
y29 = np.array(df28[\'Graphic\']) * -1
y30 = np.array(df29[\'Graphic\']) * -1
y31 = np.array(df30[\'Graphic\']) * -1
y32 = np.array(df31[\'Graphic\']) * -1
y33 = np.array(df32[\'Graphic\']) * -1
# 老滧港 2001-2019
x34 = np.array(df33[\'X\'])
x35 = np.array(df34[\'X\'])
x36 = np.array(df35[\'X\'])
x37 = np.array(df36[\'X\'])
x38 = np.array(df37[\'X\'])
x39 = np.array(df38[\'X\'])
y34 = np.array(df33[\'Graphic\']) * -1
y35 = np.array(df34[\'Graphic\']) * -1
y36 = np.array(df35[\'Graphic\']) * -1
y37 = np.array(df36[\'Graphic\']) * -1
y38 = np.array(df37[\'Graphic\']) * -1
y39 = np.array(df38[\'Graphic\']) * -1
# 张网港 1958-1998
x40 = np.array(df39[\'X\'])
x41 = np.array(df40[\'X\'])
x42 = np.array(df41[\'X\'])
x43 = np.array(df42[\'X\'])
x44 = np.array(df43[\'X\'])
x45 = np.array(df44[\'X\'])
x46 = np.array(df45[\'X\'])
y40 = np.array(df39[\'Graphic\']) * -1
y41 = np.array(df40[\'Graphic\']) * -1
y42 = np.array(df41[\'Graphic\']) * -1
y43 = np.array(df42[\'Graphic\']) * -1
y44 = np.array(df43[\'Graphic\']) * -1
y45 = np.array(df44[\'Graphic\']) * -1
y46 = np.array(df45[\'Graphic\']) * -1
# 张网港 2001-2019
x47 = np.array(df46[\'X\'])
x48 = np.array(df47[\'X\'])
x49 = np.array(df48[\'X\'])
x50 = np.array(df49[\'X\'])
x51 = np.array(df50[\'X\'])
x52 = np.array(df51[\'X\'])
y47 = np.array(df46[\'Graphic\']) * -1
y48 = np.array(df47[\'Graphic\']) * -1
y49 = np.array(df48[\'Graphic\']) * -1
y50 = np.array(df49[\'Graphic\']) * -1
y51 = np.array(df50[\'Graphic\']) * -1
y52 = np.array(df51[\'Graphic\']) * -1
# 新河港 1958- 1998
x53 = np.array(df52[\'X\'])
x54 = np.array(df53[\'X\'])
x55 = np.array(df54[\'X\'])
x56 = np.array(df55[\'X\'])
x57 = np.array(df56[\'X\'])
x58 = np.array(df57[\'X\'])
x59 = np.array(df58[\'X\'])
y53 = np.array(df52[\'Graphic\']) * -1
y54 = np.array(df53[\'Graphic\']) * -1
y55 = np.array(df54[\'Graphic\']) * -1
y56 = np.array(df55[\'Graphic\']) * -1
y57 = np.array(df56[\'Graphic\']) * -1
y58 = np.array(df57[\'Graphic\']) * -1
y59 = np.array(df58[\'Graphic\']) * -1
# 新河港 2001-2019
x60 = np.array(df59[\'X\'])
x61 = np.array(df60[\'X\'])
x62 = np.array(df61[\'X\'])
x63 = np.array(df62[\'X\'])
x64 = np.array(df63[\'X\'])
x65 = np.array(df64[\'X\'])

y60 = np.array(df59[\'Graphic\']) * -1
y61 = np.array(df60[\'Graphic\']) * -1
y62 = np.array(df61[\'Graphic\']) * -1
y63 = np.array(df62[\'Graphic\']) * -1
y64 = np.array(df63[\'Graphic\']) * -1
y65 = np.array(df64[\'Graphic\']) * -1


# 图例
fig = plt.figure(figsize=(8, 6))
plt.rcParams[\'font.sans-serif\'] = \'Microsoft YaHei\'
subplots_adjust(left=0.15,bottom=0.1,top=0.9,right=0.95,hspace=0.18,wspace=0.15)




# 鸽笼港
ax1 = fig.add_subplot(431)
ax2 = fig.add_subplot(434)
ax1.set_ylabel(\'深度 (m)\',fontsize=5)

ax2.set_ylabel(\'深度 (m)\',fontsize=5)


# 南门
ax3 = fig.add_subplot(432)
ax4 = fig.add_subplot(435)
# 老滧港
ax5 = fig.add_subplot(433)
ax6 = fig.add_subplot(436)
ax6.set_xlabel(\'离崇明岛距离 (m)\',fontsize=5)
# 张网港
ax7 = fig.add_subplot(437)
ax8 = fig.add_subplot(4,3,10)
ax7.set_ylabel(\'深度 (m)\',fontsize=5)
ax8.set_ylabel(\'深度 (m)\',fontsize=5)
ax8.set_xlabel(\'离崇明岛距离 (m)\',fontsize=5)

# 新河港
ax9 = fig.add_subplot(438)
ax10 = fig.add_subplot(4,3,11)
ax10.set_xlabel(\'离崇明岛距离 (m)\',fontsize=5)
# 鸽笼港1958-1998
ax1.plot(x1, y1, color=\'r\', label=\'1958\')
ax1.plot(x2, y2, color=\'black\', label=\'1984\')
ax1.plot(x3, y3, color=\'brown\', label=\'1987\')
ax1.plot(x4, y4, color=\'c\', label=\'1990\')
ax1.plot(x5, y5, color=\'hotpink\', label=\'1992\')
ax1.plot(x6, y6, color=\'y\', label=\'1997\')
ax1.plot(x7, y7, color=\'b\', label=\'1998\')

# 鸽笼港1998-2019
ax2.plot(x8, y8, color=\'b\', label=\'2001\')
ax2.plot(x9, y9, color=\'y\', label=\'2003\')
ax2.plot(x10, y10, color=\'hotpink\', label=\'2009\')
ax2.plot(x11, y11, color=\'c\', label=\'2013\')
ax2.plot(x12, y12, color=\'brown\', label=\'2016\')
ax2.plot(x13, y13, color=\'black\', label=\'2019\')
# 南门 1958-1998
ax3.plot(x14, y14, color=\'r\', label=\'1958\')
ax3.plot(x15, y15, color=\'black\', label=\'1984\')
ax3.plot(x16, y16, color=\'brown\', label=\'1987\')
ax3.plot(x17, y17, color=\'c\', label=\'1990\')
ax3.plot(x18, y18, color=\'hotpink\', label=\'1992\')
ax3.plot(x19, y19, color=\'y\', label=\'1997\')
ax3.plot(x20, y20, color=\'b\', label=\'1998\')
# 南门2001-2019
ax4.plot(x21, y21, color=\'b\', label=\'2001\')
ax4.plot(x22, y22, color=\'y\', label=\'2003\')
ax4.plot(x23, y23, color=\'hotpink\', label=\'2009\')
ax4.plot(x24, y24, color=\'c\', label=\'2013\')
ax4.plot(x25, y25, color=\'brown\', label=\'2016\')
ax4.plot(x26, y26, color=\'black\', label=\'2019\')
# 老滧港1958-1998

ax5.plot(x27, y27, color=\'r\', label=\'1958\')
ax5.plot(x28, y28, color=\'black\', label=\'1984\')
ax5.plot(x29, y29, color=\'brown\', label=\'1987\')
ax5.plot(x30, y30, color=\'c\', label=\'1990\')
ax5.plot(x31, y31, color=\'hotpink\', label=\'1992\')
ax5.plot(x32, y32, color=\'y\', label=\'1997\')
ax5.plot(x33, y33, color=\'b\', label=\'1998\')
# 老滧港2001-2019
ax6.plot(x34, y34, color=\'b\', label=\'2001\')
ax6.plot(x35, y35, color=\'y\', label=\'2003\')
ax6.plot(x36, y36, color=\'hotpink\', label=\'2009\')
ax6.plot(x37, y37, color=\'c\', label=\'2013\')
ax6.plot(x38, y38, color=\'brown\', label=\'2016\')
ax6.plot(x39, y39, color=\'black\', label=\'2019\')
# 张网港1958-1998
ax7.plot(x40, y40, color=\'r\', label=\'1958\')
ax7.plot(x41, y41, color=\'black\', label=\'1984\')
ax7.plot(x42, y42, color=\'brown\', label=\'1987\')
ax7.plot(x43, y43, color=\'c\', label=\'1990\')
ax7.plot(x44, y44, color=\'hotpink\', label=\'1992\')
ax7.plot(x45, y45, color=\'y\', label=\'1997\')
ax7.plot(x46, y46, color=\'b\', label=\'1998\')
# 张网港 2001-2019
ax8.plot(x47, y47, color=\'b\', label=\'2001\')
ax8.plot(x48, y48, color=\'y\', label=\'2003\')
ax8.plot(x49, y49, color=\'hotpink\', label=\'2009\')
ax8.plot(x50, y50, color=\'c\', label=\'2013\')
ax8.plot(x51, y51, color=\'brown\', label=\'2016\')
ax8.plot(x52, y52, color=\'black\', label=\'2019\')
# 新河港 1958-1998
ax9.plot(x53, y53, color=\'r\', label=\'1958\')
ax9.plot(x54, y54, color=\'black\', label=\'1984\')
ax9.plot(x55, y55, color=\'brown\', label=\'1987\')
ax9.plot(x56, y56, color=\'c\', label=\'1990\')
ax9.plot(x57, y57, color=\'hotpink\', label=\'1992\')
ax9.plot(x58, y58, color=\'y\', label=\'1997\')
ax9.plot(x59, y59, color=\'b\', label=\'1998\')
# 新河港2001-2019
ax10.plot(x60, y60, color=\'b\', label=\'2001\')
ax10.plot(x61, y61, color=\'y\', label=\'2003\')
ax10.plot(x62, y62, color=\'hotpink\', label=\'2009\')
ax10.plot(x63, y63, color=\'c\', label=\'2013\')
ax10.plot(x64, y64, color=\'brown\', label=\'2016\')
ax10.plot(x65, y65, color=\'black\', label=\'2019\')
#
ax1.legend(prop=font1, loc=1, ncol=7)
ax2.legend(prop=font1, loc=1, ncol=7)
ax3.legend(prop=font1, loc=1, ncol=7)
ax4.legend(prop=font1, loc=1, ncol=7)
ax5.legend(prop=font1, loc=1, ncol=7)
ax6.legend(prop=font1, loc=1, ncol=7)
ax7.legend(prop=font1, loc=1, ncol=7)
ax8.legend(prop=font1, loc=1, ncol=7)
ax9.legend(prop=font1, loc=1, ncol=7)
ax10.legend(prop=font1, loc=1, ncol=7)
# plt.savefig(r\'.\4.png\',dpi =1600)
plt.show()

分类:

技术点:

相关文章: